From 6fd5aef0cb0a990596dd505b6c2f255030ce218d Mon Sep 17 00:00:00 2001 From: Erik LaBianca Date: Tue, 27 Oct 2026 14:45:13 -0400 Subject: [PATCH] ci: verify tag source with current release tooling --- .github/workflows/release.yml | 30 +++++++++++++++++------- tests/unit/test_distribution_identity.py | 4 +++- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cb47b74..95efa05 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -97,8 +97,15 @@ jobs: - name: Checkout code uses: actions/checkout@v4 with: - fetch-depth: 0 # Full history for version calculation + ref: ${{ github.sha }} # Use the workflow/verifier source for this run. + + - name: Checkout tagged package source + uses: actions/checkout@v4 + with: + repository: ${{ github.repository }} ref: ${{ inputs.release_tag || github.ref }} + path: source + fetch-depth: 0 # Include the release tag for dynamic versioning. - name: Set up Python uses: actions/setup-python@v5 @@ -111,7 +118,8 @@ jobs: enable-cache: true - name: Build package - run: uv build + working-directory: source + run: uv build --out-dir ../dist - name: Verify build run: | @@ -125,7 +133,7 @@ jobs: python scripts/verify_release_artifacts.py create-manifest \ --dist-dir dist --output dist/release-manifest.json \ --tag "$RELEASE_TAG" --repository "$GITHUB_REPOSITORY" \ - --source-commit "$(git rev-parse HEAD)" --package umf-tablespec + --source-commit "$(git -C source rev-parse HEAD)" --package umf-tablespec - name: Upload build artifacts uses: actions/upload-artifact@v4 @@ -200,7 +208,13 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 # Required by Hugo enableGitInfo. + - name: Checkout tagged site source + uses: actions/checkout@v4 + with: + repository: ${{ github.repository }} ref: ${{ inputs.release_tag || github.ref }} + path: source + fetch-depth: 0 # Required by Hugo enableGitInfo. - name: Set up Python uses: actions/setup-python@v5 @@ -211,14 +225,14 @@ jobs: uses: actions/setup-go@v5 with: go-version: '1.23.x' - cache-dependency-path: website/go.sum + cache-dependency-path: source/website/go.sum - name: Set up Node uses: actions/setup-node@v4 with: node-version: '22' cache: npm - cache-dependency-path: website/package-lock.json + cache-dependency-path: source/website/package-lock.json - name: Set up Hugo uses: peaceiris/actions-hugo@v3 @@ -233,7 +247,7 @@ jobs: path: dist/ - name: Build Hugo microsite - working-directory: website + working-directory: source/website run: | npm ci hugo --gc --minify @@ -243,8 +257,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | TAG="$RELEASE_TAG" - python scripts/build_pages_artifact.py \ - --site-dir website/public \ + python source/scripts/build_pages_artifact.py \ + --site-dir source/website/public \ --dist-dir dist \ --out-dir pages \ --repo "$GITHUB_REPOSITORY" \ diff --git a/tests/unit/test_distribution_identity.py b/tests/unit/test_distribution_identity.py index 4ec05da..00a9269 100644 --- a/tests/unit/test_distribution_identity.py +++ b/tests/unit/test_distribution_identity.py @@ -78,4 +78,6 @@ def test_release_workflows_bind_both_package_identities(): assert "workflow_dispatch:" in release assert "ref: ${{ inputs.release_tag || github.ref }}" in release assert 'git rev-parse "refs/tags/$RELEASE_TAG^{commit}"' in release - assert '--source-commit "$(git rev-parse HEAD)"' in release + assert "ref: ${{ github.sha }}" in release + assert "path: source" in release + assert '--source-commit "$(git -C source rev-parse HEAD)"' in release