name: Release Preflight # Zero-touch auth dry-run for every external publish surface. # Run on demand before cutover and after any secret rotation. # Publishes nothing. Any failure here should be fixed before a real tag is pushed. on: workflow_dispatch: permissions: contents: read id-token: write # npm OIDC provenance dry-run, ECR Public OIDC, crates.io probe packages: read # required for GHCR auth probe jobs: preflight: name: Release preflight runs-on: ubuntu-latest timeout-minutes: 15 steps: - uses: actions/checkout@v5 # The dry runs below prove the registries would accept a publish. They # say nothing about whether the version sources agree with each other, # which is the failure this preflight exists to catch early. - name: Check version sources agree id: version-check continue-on-error: true run: scripts/check-versions.sh # --- crates.io ----------------------------------------------------- - uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 # crates.io auth is Trusted Publishing, so there is no stored secret # left for this step to exercise; it proves the crate packages cleanly # and nothing more. Whether crates.io would accept the publish is the # next step's job. - name: cargo publish --dry-run id: cargo-check continue-on-error: true run: cargo publish --dry-run # Confirms release.yml and publish-crate.yml are both registered on # crates.io, by asking for a token this workflow is not allowed to have # and reading the refusal. No token is ever minted. The script explains # why that is the right way round. - name: crates.io Trusted Publishing probe id: trustpub-check continue-on-error: true run: scripts/trustpub-probe.sh release.yml publish-crate.yml # --- npm OIDC ------------------------------------------------------ - uses: actions/setup-node@v5 with: node-version: "24" - name: Configure npm registry run: npm config set registry https://registry.npmjs.org - name: npm publish --dry-run --provenance (meta package) id: npm-check continue-on-error: true working-directory: npm/dynoxide # The package.json carries a placeholder prerelease version # (0.0.0-development) that publish.sh rewrites at real publish time. # npm requires --tag for prerelease dry-runs; the value is inert since # nothing is published. run: npm publish --dry-run --provenance --tag preflight # --- Homebrew tap -------------------------------------------------- - name: Probe Homebrew tap access id: homebrew-check continue-on-error: true env: GH_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} # Probe the exact endpoint the formula push uses so a fine-grained PAT # scoped to the Formula path still passes this check. A bare # "gh api repos/..." call rejects fine-grained tokens that have file- # scoped access without metadata read. run: | set -euo pipefail if [ -z "${GH_TOKEN:-}" ]; then echo "::error::HOMEBREW_TAP_TOKEN is not set on this repo" exit 1 fi HTTP_STATUS=$(gh api -i repos/nubo-db/homebrew-tap/contents/Formula/dynoxide.rb 2>&1 | head -1 || true) echo "response: $HTTP_STATUS" if ! gh api repos/nubo-db/homebrew-tap/contents/Formula/dynoxide.rb --jq '.sha' >/dev/null 2>&1; then echo "::error::HOMEBREW_TAP_TOKEN cannot access Formula/dynoxide.rb in nubo-db/homebrew-tap (auth rejected, expired, or not set)" exit 1 fi echo "Homebrew tap access confirmed" # --- GHCR --------------------------------------------------------- - name: GHCR auth probe id: ghcr-check continue-on-error: true uses: docker/login-action@v4 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} # --- Docker Hub --------------------------------------------------- - name: Docker Hub auth probe id: dockerhub-check continue-on-error: true uses: docker/login-action@v4 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} # --- ECR Public --------------------------------------------------- - name: ECR Public AWS credentials probe id: ecr-public-creds continue-on-error: true uses: aws-actions/configure-aws-credentials@v6 with: role-to-assume: ${{ vars.ECR_PUBLIC_PUBLISH_ROLE_ARN }} aws-region: us-east-1 - name: ECR Public auth token probe id: ecr-public-check if: steps.ecr-public-creds.outcome == 'success' continue-on-error: true # Discard the token output so GitHub's secret masking does not have to # race the runner log buffer. run: aws ecr-public get-authorization-token --region us-east-1 --query 'authorizationData.authorizationToken' --output text > /dev/null # --- Summary and final gate --------------------------------------- - name: Preflight summary if: always() env: VERSION_OUTCOME: ${{ steps.version-check.outcome }} CARGO_OUTCOME: ${{ steps.cargo-check.outcome }} TRUSTPUB_OUTCOME: ${{ steps.trustpub-check.outcome }} NPM_OUTCOME: ${{ steps.npm-check.outcome }} HOMEBREW_OUTCOME: ${{ steps.homebrew-check.outcome }} GHCR_OUTCOME: ${{ steps.ghcr-check.outcome }} DOCKERHUB_OUTCOME: ${{ steps.dockerhub-check.outcome }} ECR_OUTCOME: ${{ steps.ecr-public-check.outcome }} run: | { echo "## Release Preflight" echo "" echo "| Check | Result |" echo "|-------|--------|" echo "| version sources agree | $VERSION_OUTCOME |" echo "| cargo publish --dry-run | $CARGO_OUTCOME |" echo "| crates.io Trusted Publishing config | $TRUSTPUB_OUTCOME |" echo "| npm publish --dry-run --provenance (meta) | $NPM_OUTCOME |" echo "| Homebrew tap write-access probe | $HOMEBREW_OUTCOME |" echo "| GHCR auth probe | $GHCR_OUTCOME |" echo "| Docker Hub auth probe | $DOCKERHUB_OUTCOME |" echo "| ECR Public auth probe | ${ECR_OUTCOME:-skipped} |" echo "" echo "Run: ${{ github.run_id }}" echo "Triggered by: ${{ github.actor }}" } >> "$GITHUB_STEP_SUMMARY" if [ "$VERSION_OUTCOME" != "success" ] || \ [ "$CARGO_OUTCOME" != "success" ] || \ [ "$TRUSTPUB_OUTCOME" != "success" ] || \ [ "$NPM_OUTCOME" != "success" ] || \ [ "$HOMEBREW_OUTCOME" != "success" ] || \ [ "$GHCR_OUTCOME" != "success" ] || \ [ "$DOCKERHUB_OUTCOME" != "success" ] || \ [ "$ECR_OUTCOME" != "success" ]; then echo "::error::One or more preflight checks failed. See summary for details." exit 1 fi echo "All preflight checks passed."