Files
pipdock/.github/workflows/release.yml
T
poli0981andClaude Opus 5.5 ccae96dbeb chore: move to poli0981org — self-contained CI, Qodana, an npm licence gate, this week's dependencies (#119)
The repository now lives in the poli0981org organization, and this makes it at home there.

- main was red since 2026-11-18: RUSTSEC-2026-0543 (chrono), in Cargo.lock only through serde_with's weak features and compiled into nothing; ignored with its reason and exit condition.
- Supersedes #113–#118 (Rust 1.100.0, rusqlite 0.42.0, Tauri 2.12.6, code-health pins, actions, npm) plus jsdom 31.0.1; minimatch 11 closes GHSA-g3hv-75wg-m249. rfd 0.18 (#112) is held again until tauri-plugin-dialog moves.
- Dependabot's tauri groups never worked (it picks the most specific group); exclude-patterns on the catch-alls fix it.
- CI is self-contained: no workflow calls poli0981/.github; every action is pinned by commit; notify.yml vendors the Discord notifier.
- npm licences: scripts/check-licenses.mjs, deny.toml's allowlist for the npm half. Required, with cargo deny and tauri lockstep — eight required checks.
- Qodana in two parts (Rust, TS/JS), full scans, a triaged Rust baseline, fail on anything new. The Rust container needed its toolchain and CARGO_HOME pointed somewhere writable before it analysed anything.
- SonarQube Cloud analyses into poli0981org_pipdock; every npm ci runs with --ignore-scripts (S6505).
- Every repository URL points at the organization. README's attestation command for 1.4.0/1.5.0 had stopped working; it now says --owner poli0981 --signer-repo poli0981/pipdock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 21:50:41 +07:00

199 lines
8.6 KiB
YAML

# Project-local, like every workflow here (RELEASE-CI.md §1).
#
# Builds the NSIS .exe and .msi, attests where they were built, publishes SHA256SUMS.txt and leaves
# a DRAFT release. Publishing is a separate, human-directed step (RELEASE-CI.md §3.4), and
# notify.yml's announcement fires on `release: published`.
#
# **Two jobs, so the token that can write releases never runs the build.** Building executes
# third-party code — every crate's build script, every npm package's — and gets a read-only token
# with no credentials left in the checkout. The publish job only attests and uploads what the build
# produced.
#
# `workflow_dispatch` with `dry_run` builds and checksums any ref — a branch before it merges —
# without attesting or drafting anything: the release recipe is tested before a tag depends on it.
#
# PipDock does not update itself, so there is no signing key and no `latest.json` here. Users get
# new versions from the GitHub Releases page; the checksums and the attestation are what they
# verify against (docs/SECURITY.md §5).
name: Release
on:
push:
tags: ['v*']
workflow_dispatch:
inputs:
tag:
description: Tag to build (for re-runs). Empty builds the selected ref.
required: false
type: string
dry_run:
description: Build and checksum only — no attestation, no draft release.
required: false
type: boolean
default: false
permissions:
contents: read
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build · checksum
runs-on: windows-latest
timeout-minutes: 90
permissions:
contents: read
outputs:
tag: ${{ steps.version.outputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.tag || github.ref }}
persist-credentials: false
# The version lives in five places and they move together (CLAUDE.md), and a tag names the
# one they must all carry. A tag pushed before the bump commit, or a bump that missed one
# file, would otherwise build an installer whose About states another version.
- name: The tag and all five versions agree
id: version
shell: pwsh
env:
REF: ${{ inputs.tag || github.ref_name }}
DRY_RUN: ${{ inputs.dry_run || false }}
run: |
$ErrorActionPreference = 'Stop'
$found = [ordered]@{}
$found['Cargo.toml'] = (Select-String -Path Cargo.toml -Pattern '^version = "([^"]+)"' |
Select-Object -First 1).Matches[0].Groups[1].Value
$lock = Get-Content Cargo.lock -Raw
if ($lock -notmatch '(?m)^name = "pipdock-core"\r?\nversion = "([^"]+)"') { throw 'pipdock-core is not in Cargo.lock' }
$found['Cargo.lock'] = $Matches[1]
$found['package.json'] = (Get-Content package.json -Raw | ConvertFrom-Json).version
# -AsHashtable: package-lock.json has a property named "", which plain ConvertFrom-Json refuses.
$found['package-lock.json'] = (Get-Content package-lock.json -Raw | ConvertFrom-Json -AsHashtable)['version']
$found['tauri.conf.json'] = (Get-Content src-tauri/tauri.conf.json -Raw | ConvertFrom-Json).version
$found.GetEnumerator() | ForEach-Object { Write-Host ("{0,-18} {1}" -f $_.Key, $_.Value) }
$versions = @($found.Values | Sort-Object -Unique)
if ($versions.Count -ne 1) { throw "the five versions disagree: $($versions -join ', ')" }
$v = $versions[0]
if ($env:REF -match '^v\d') {
if ($env:REF -ne "v$v") { throw "tag $env:REF does not match version $v" }
} elseif ($env:DRY_RUN -ne 'true') {
throw "$env:REF is not a version tag; only a dry run builds a branch"
}
"tag=v$v" >> $env:GITHUB_OUTPUT
- name: Setup Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: '26'
cache: npm
- name: Cache cargo
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock', 'rust-toolchain.toml') }}
restore-keys: ${{ runner.os }}-cargo-release-
# No install script runs: the only package in the lockfile that has one is fsevents, which
# is macOS-only, and a lifecycle script is how a compromised dependency runs on the runner
# (SonarCloud githubactions:S6505). The bundle does not need them: Tauri's CLI arrives as
# an optional platform package, not a download in a postinstall.
- name: Install frontend dependencies
run: npm ci --ignore-scripts
# One script owns the recipe (`package.json` → `bundle`), so the workflow cannot drift
# from what a developer runs locally. It stages the CLI sidecar, then bundles with the
# overlay config that declares it.
#
# **The overlay exists because `tauri-build` validates `externalBin` at build-script time.**
# Declaring the sidecar in `tauri.conf.json` made plain `cargo clippy` and `cargo test` fail
# in a fresh clone with "resource path ... doesn't exist" — a bundling concern leaking into
# every compile. `--config` merges it in only when bundling.
- name: Build and bundle
run: npm run bundle
- name: Collect artifacts
shell: pwsh
run: |
$out = "release-artifacts"
New-Item -ItemType Directory -Force $out | Out-Null
Get-ChildItem -Recurse target\release\bundle -Include *.exe, *.msi |
ForEach-Object { Copy-Item $_.FullName $out }
Get-ChildItem $out
- name: Checksums
shell: pwsh
run: |
# SmartScreen warns on first run because the binaries are not EV-code-signed, so the
# README tells users to verify these instead (docs/SECURITY.md §5).
#
# LF line endings, written byte for byte: `Set-Content` wrote CRLF, and `sha256sum -c`
# on any other platform reads the CR as part of the file name and reports it missing.
$lines = Get-ChildItem release-artifacts -File |
Where-Object { $_.Name -ne 'SHA256SUMS.txt' } |
Sort-Object Name |
ForEach-Object { "$((Get-FileHash $_.FullName -Algorithm SHA256).Hash.ToLower()) $($_.Name)" }
[IO.File]::WriteAllText(
(Join-Path $PWD 'release-artifacts\SHA256SUMS.txt'),
(($lines -join "`n") + "`n"),
[Text.Encoding]::ASCII)
Get-Content release-artifacts\SHA256SUMS.txt
- name: Upload the build
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: release-artifacts
path: release-artifacts/*
if-no-files-found: error
publish:
name: Attest · draft
needs: build
if: ${{ !inputs.dry_run }}
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write # the draft release and its assets
id-token: write # Sigstore, for the attestation
attestations: write
steps:
- name: Download the build
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: release-artifacts
path: release-artifacts
# Build provenance for the two installers: `gh attestation verify <file> --repo
# poli0981org/pipdock` proves an installer came from this workflow, at this commit — which a
# checksum published beside the file cannot, since whoever could replace one could replace
# both. An attestation stays with the account that made it: those of 1.4.0 and 1.5.0, made
# before the repository moved to the organization, verify with `--owner poli0981
# --signer-repo poli0981/pipdock` and no longer with any `--repo` (README, Install).
- name: Attest provenance
uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
with:
subject-path: |
release-artifacts/*.exe
release-artifacts/*.msi
- name: Draft GitHub release
uses: softprops/action-gh-release@8a0cd651e5b2365bd640854a3fa5dfc70e4875f3 # v3.0.4
with:
tag_name: ${{ needs.build.outputs.tag }}
draft: true # reviewed, then published; publishing triggers the announcement
generate_release_notes: true
files: release-artifacts/*