diff --git a/.github/workflows/modpoll-release.yml b/.github/workflows/modpoll-release.yml index b3d6f28..4d1e350 100644 --- a/.github/workflows/modpoll-release.yml +++ b/.github/workflows/modpoll-release.yml @@ -16,6 +16,7 @@ defaults: working-directory: packages/modpoll jobs: candidate: + name: modpoll release candidate runs-on: ubuntu-latest outputs: git-tag: ${{ steps.release.outputs.git-tag }} @@ -32,7 +33,11 @@ jobs: else git_tag="modpoll-v$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')" fi - git rev-parse --verify "refs/tags/$git_tag^{commit}" + # Changing this file before the current version is tagged has nothing to republish yet. + if ! git rev-parse --verify --quiet "refs/tags/$git_tag^{commit}" >/dev/null; then + echo "::notice::$git_tag is not tagged yet; nothing to republish." + exit 0 + fi git merge-base --is-ancestor "refs/tags/$git_tag^{commit}" origin/v2 tag="${git_tag#modpoll-}" image_version="${tag#v}" @@ -43,6 +48,7 @@ jobs: echo "tag=$tag" >> "$GITHUB_OUTPUT" echo "image-version=$image_version" >> "$GITHUB_OUTPUT" publish: + name: modpoll release publish needs: candidate if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest @@ -97,8 +103,9 @@ jobs: fi gh release upload "$GIT_TAG" dist/* image: + name: modpoll release image needs: [candidate, publish] - if: ${{ !cancelled() && needs.candidate.result == 'success' && (needs.publish.result == 'success' || (github.ref_name == 'v2' && needs.publish.result == 'skipped')) }} + if: ${{ !cancelled() && needs.candidate.result == 'success' && needs.candidate.outputs.git-tag != '' && (needs.publish.result == 'success' || (github.ref_name == 'v2' && needs.publish.result == 'skipped')) }} runs-on: ubuntu-latest steps: # Build the released source: a push to v2 that changes this file republishes the current @@ -131,8 +138,9 @@ jobs: docker buildx build --platform linux/amd64,linux/arm64 -f Dockerfile -t "$image" --push ../.. fi docs: + name: modpoll release docs needs: [candidate, publish] - if: ${{ !cancelled() && needs.candidate.result == 'success' && (needs.publish.result == 'success' || (github.ref_name == 'v2' && needs.publish.result == 'skipped')) }} + if: ${{ !cancelled() && needs.candidate.result == 'success' && needs.candidate.outputs.git-tag != '' && (needs.publish.result == 'success' || (github.ref_name == 'v2' && needs.publish.result == 'skipped')) }} runs-on: ubuntu-latest concurrency: group: modpoll-pages @@ -172,6 +180,7 @@ jobs: github_token: ${{ github.token }} publish_dir: packages/modpoll/.site acceptance: + name: modpoll release acceptance needs: [candidate, publish, image, docs] if: ${{ !cancelled() && needs.docs.result == 'success' && needs.image.result == 'success' }} runs-on: ubuntu-latest diff --git a/.github/workflows/modpoll-wot-release.yml b/.github/workflows/modpoll-wot-release.yml index 25b1933..6d2d324 100644 --- a/.github/workflows/modpoll-wot-release.yml +++ b/.github/workflows/modpoll-wot-release.yml @@ -17,6 +17,7 @@ defaults: jobs: publish: + name: modpoll-wot release publish runs-on: ubuntu-latest permissions: contents: write diff --git a/.github/workflows/modsim-release.yml b/.github/workflows/modsim-release.yml index eced384..24c156a 100644 --- a/.github/workflows/modsim-release.yml +++ b/.github/workflows/modsim-release.yml @@ -26,6 +26,7 @@ defaults: jobs: publish: + name: modsim release publish if: github.event_name == 'push' runs-on: ubuntu-latest permissions: @@ -76,6 +77,7 @@ jobs: gh release upload "$GIT_TAG" dist/* image: + name: modsim release image needs: publish runs-on: ubuntu-latest steps: @@ -100,6 +102,7 @@ jobs: # The modsim documentation site is not published from this repository yet (TOOL-01 decision 7); the # release still proves that the preview documentation builds. docs: + name: modsim release docs needs: publish runs-on: ubuntu-latest steps: @@ -112,6 +115,7 @@ jobs: - run: uv run --locked --no-sync --group docs mkdocs build -s -f mkdocs-preview.yml --site-dir "$RUNNER_TEMP/site" acceptance: + name: modsim release acceptance if: ${{ always() && (github.event_name == 'workflow_dispatch' || (needs.publish.result == 'success' && needs.image.result == 'success' && needs.docs.result == 'success')) }} needs: [publish, image, docs] runs-on: ubuntu-latest