No double runs in a release: container test and weekly tests once
A version bump's push started docker.yml's test, then auto-release started docker.yml again for the tag, which tests the same code before it publishes: the push skips its test while the version is not tagged. The deploy re-ran the weekly-puzzle tests even when main's weekly files are the tag's own, which CI had just tested: it now runs them only for files that differ (a newer or refitted week) or an untested tag.
This commit is contained in:
parent
03523cb16b
commit
4e6f780c81
2 changed files with 34 additions and 2 deletions
23
.github/workflows/docker.yml
vendored
23
.github/workflows/docker.yml
vendored
|
|
@ -38,7 +38,30 @@ concurrency:
|
|||
cancel-in-progress: ${{ github.event_name != 'workflow_dispatch' }}
|
||||
|
||||
jobs:
|
||||
# A push that bumps the version is a release on its way: once CI passes, auto-release.yml starts this workflow for
|
||||
# the tag, which tests the same code before it publishes. Testing the push too would be the same run twice.
|
||||
gate:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
run: ${{ steps.g.outputs.run }}
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
ref: ${{ inputs.tag || '' }}
|
||||
persist-credentials: false
|
||||
- id: g
|
||||
run: |
|
||||
tag="v$(jq -r .version package.json)"
|
||||
if [ "$GITHUB_EVENT_NAME" = push ] && ! git ls-remote --exit-code --tags origin "refs/tags/$tag" >/dev/null; then
|
||||
echo "$tag is not tagged yet: the release will test this commit when it publishes."
|
||||
echo "run=false" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "run=true" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
test:
|
||||
needs: gate
|
||||
if: needs.gate.outputs.run == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue