ci(release): publish once daily at 7am Paris time
- commit
- f4b82d1320929eae68ef84ed059d4aa64bbcd9ae
- author
- brice · · 2026-08-09 09:21 UTC
- committer
- brice · · 2026-08-09 09:21 UTC
- parent
- 38097d7
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
1 file · +25 -13
M .github/workflows/release.yml +25 -13
| @@ -1,13 +1,12 @@ | |||
| 1 | 1 | name: release | |
| 2 | 2 | ||
| 3 | - | # After CI succeeds on main, create at most one tag for the unreleased | |
| 4 | - | # conventional commits. The tag is then built by the shared GoReleaser | |
| 5 | - | # workflow at its exact commit. | |
| 3 | + | # Once each morning, create at most one tag for the unreleased conventional | |
| 4 | + | # commits on main. GitHub schedules in UTC, so both possible UTC offsets are | |
| 5 | + | # triggered and the first step keeps only the 07:00 Europe/Paris run. | |
| 6 | 6 | on: | |
| 7 | - | workflow_run: | |
| 8 | - | workflows: [ci] | |
| 9 | - | types: [completed] | |
| 10 | - | branches: [main] | |
| 7 | + | schedule: | |
| 8 | + | - cron: "0 5,6 * * *" | |
| 9 | + | workflow_dispatch: | |
| 11 | 10 | ||
| 12 | 11 | permissions: | |
| 13 | 12 | contents: write | |
| @@ -18,26 +17,39 @@ concurrency: | |||
| 18 | 17 | ||
| 19 | 18 | jobs: | |
| 20 | 19 | tag: | |
| 21 | - | if: >- | |
| 22 | - | github.event.workflow_run.conclusion == 'success' && | |
| 23 | - | github.event.workflow_run.head_branch == 'main' && | |
| 24 | - | !contains(github.event.workflow_run.head_commit.message, '[release=skip]') | |
| 25 | 20 | runs-on: ubuntu-latest | |
| 26 | 21 | outputs: | |
| 27 | 22 | tag: ${{ steps.version.outputs.tag }} | |
| 28 | 23 | steps: | |
| 29 | - | - name: Check out the verified commit | |
| 24 | + | - name: Check the Paris release time | |
| 25 | + | id: release-time | |
| 26 | + | shell: bash | |
| 27 | + | env: | |
| 28 | + | EVENT_NAME: ${{ github.event_name }} | |
| 29 | + | TZ: Europe/Paris | |
| 30 | + | run: | | |
| 31 | + | if [ "$EVENT_NAME" = workflow_dispatch ] || [ "$(date +%H)" = 07 ]; then | |
| 32 | + | echo "run=true" >> "$GITHUB_OUTPUT" | |
| 33 | + | fi | |
| 34 | + | ||
| 35 | + | - name: Check out main | |
| 36 | + | if: steps.release-time.outputs.run == 'true' | |
| 30 | 37 | uses: actions/checkout@v4 | |
| 31 | 38 | with: | |
| 32 | 39 | fetch-depth: 0 | |
| 33 | 40 | fetch-tags: true | |
| 34 | - | ref: ${{ github.event.workflow_run.head_sha }} | |
| 41 | + | ref: main | |
| 35 | 42 | ||
| 36 | 43 | - name: Compute the next release tag | |
| 44 | + | if: steps.release-time.outputs.run == 'true' | |
| 37 | 45 | id: version | |
| 38 | 46 | shell: bash | |
| 39 | 47 | run: | | |
| 40 | 48 | set -euo pipefail | |
| 49 | + | if git log -1 --format=%B | grep -Fq '[release=skip]'; then | |
| 50 | + | echo "The latest commit requested that the release be skipped." | |
| 51 | + | exit 0 | |
| 52 | + | fi | |
| 41 | 53 | tag=$(bash .github/scripts/next-release-tag.sh) | |
| 42 | 54 | if [ -z "$tag" ]; then | |
| 43 | 55 | echo "No releasable conventional commits for this run." | |
| @@ -1,13 +1,12 @@ | |||||
| 1 | name: release | 1 | name: release | ||
| 2 | 2 | ||||
| 3 | - | # After CI succeeds on main, create at most one tag for the unreleased | 3 | + | # Once each morning, create at most one tag for the unreleased conventional |
| 4 | - | # conventional commits. The tag is then built by the shared GoReleaser | 4 | + | # commits on main. GitHub schedules in UTC, so both possible UTC offsets are |
| 5 | - | # workflow at its exact commit. | 5 | + | # triggered and the first step keeps only the 07:00 Europe/Paris run. |
| 6 | on: | 6 | on: | ||
| 7 | - | workflow_run: | 7 | + | schedule: |
| 8 | - | workflows: [ci] | 8 | + | - cron: "0 5,6 * * *" |
| 9 | - | types: [completed] | 9 | + | workflow_dispatch: |
| 10 | - | branches: [main] | |||
| 11 | 10 | ||||
| 12 | permissions: | 11 | permissions: | ||
| 13 | contents: write | 12 | contents: write | ||
| @@ -18,26 +17,39 @@ concurrency: | |||||
| 18 | 17 | ||||
| 19 | jobs: | 18 | jobs: | ||
| 20 | tag: | 19 | tag: | ||
| 21 | - | if: >- | |||
| 22 | - | github.event.workflow_run.conclusion == 'success' && | |||
| 23 | - | github.event.workflow_run.head_branch == 'main' && | |||
| 24 | - | !contains(github.event.workflow_run.head_commit.message, '[release=skip]') | |||
| 25 | runs-on: ubuntu-latest | 20 | runs-on: ubuntu-latest | ||
| 26 | outputs: | 21 | outputs: | ||
| 27 | tag: ${{ steps.version.outputs.tag }} | 22 | tag: ${{ steps.version.outputs.tag }} | ||
| 28 | steps: | 23 | steps: | ||
| 29 | - | - name: Check out the verified commit | 24 | + | - name: Check the Paris release time |
| 25 | + | id: release-time | |||
| 26 | + | shell: bash | |||
| 27 | + | env: | |||
| 28 | + | EVENT_NAME: ${{ github.event_name }} | |||
| 29 | + | TZ: Europe/Paris | |||
| 30 | + | run: | | |||
| 31 | + | if [ "$EVENT_NAME" = workflow_dispatch ] || [ "$(date +%H)" = 07 ]; then | |||
| 32 | + | echo "run=true" >> "$GITHUB_OUTPUT" | |||
| 33 | + | fi | |||
| 34 | + | ||||
| 35 | + | - name: Check out main | |||
| 36 | + | if: steps.release-time.outputs.run == 'true' | |||
| 30 | uses: actions/checkout@v4 | 37 | uses: actions/checkout@v4 | ||
| 31 | with: | 38 | with: | ||
| 32 | fetch-depth: 0 | 39 | fetch-depth: 0 | ||
| 33 | fetch-tags: true | 40 | fetch-tags: true | ||
| 34 | - | ref: ${{ github.event.workflow_run.head_sha }} | 41 | + | ref: main |
| 35 | 42 | ||||
| 36 | - name: Compute the next release tag | 43 | - name: Compute the next release tag | ||
| 44 | + | if: steps.release-time.outputs.run == 'true' | |||
| 37 | id: version | 45 | id: version | ||
| 38 | shell: bash | 46 | shell: bash | ||
| 39 | run: | | 47 | run: | | ||
| 40 | set -euo pipefail | 48 | set -euo pipefail | ||
| 49 | + | if git log -1 --format=%B | grep -Fq '[release=skip]'; then | |||
| 50 | + | echo "The latest commit requested that the release be skipped." | |||
| 51 | + | exit 0 | |||
| 52 | + | fi | |||
| 41 | tag=$(bash .github/scripts/next-release-tag.sh) | 53 | tag=$(bash .github/scripts/next-release-tag.sh) | ||
| 42 | if [ -z "$tag" ]; then | 54 | if [ -z "$tag" ]; then | ||
| 43 | echo "No releasable conventional commits for this run." | 55 | echo "No releasable conventional commits for this run." | ||