Skip to content

Commit 17b15a4

Browse files
committed
Add nightly release tag workflow and adapt CI for moving tags
Add a scheduled workflow (nightly-release-tags.yaml) that force-updates a `release-0.7-latest` annotated tag to the tip of the release-0.7 branch using a dedicated PAT (RELEASE_TAG_PUSH_TOKEN) so downstream release workflows are triggered. The tag is only moved when the branch HEAD has actually changed, avoiding unnecessary rebuilds. Adapt existing release workflows for `*-latest` tags: - Publish as prerelease instead of draft, with asset overwrite enabled. - Skip CodeQL analysis only for nightly tags, not for branches that happen to end in "-latest". - Exclude `*-latest` tags from non-release CI workflows via tags-ignore. - Narrow publish-docs tag filter to `v*` to prevent docs deployment on nightly tag pushes. Forks without the token secret skip nightly tag updates gracefully; the official repository fails fast if the secret is missing. Amp-Thread-ID: https://ampcode.com/threads/T-019d0f7e-bb56-7572-a7e0-ca9fb71d69a3 Signed-off-by: Peter M <petermm@gmail.com>
1 parent 5327f78 commit 17b15a4

11 files changed

+154
-8
lines changed

.github/workflows/build-libraries.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,10 @@ jobs:
126126
uses: softprops/action-gh-release@v1
127127
if: startsWith(github.ref, 'refs/tags/')
128128
with:
129-
draft: true
129+
draft: ${{ !endsWith(github.ref_name, '-latest') }}
130+
prerelease: ${{ endsWith(github.ref_name, '-latest') }}
130131
fail_on_unmatched_files: true
132+
overwrite_files: ${{ endsWith(github.ref_name, '-latest') }}
131133
files: |
132134
build/libs/atomvmlib-${{ github.ref_name }}.avm
133135
build/libs/atomvmlib-${{ github.ref_name }}.avm.sha256

.github/workflows/build-linux-artifacts.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,9 @@ jobs:
253253
uses: softprops/action-gh-release@v1
254254
if: startsWith(github.ref, 'refs/tags/')
255255
with:
256-
draft: true
256+
draft: ${{ !endsWith(github.ref_name, '-latest') }}
257+
prerelease: ${{ endsWith(github.ref_name, '-latest') }}
257258
fail_on_unmatched_files: true
259+
overwrite_files: ${{ endsWith(github.ref_name, '-latest') }}
258260
files: |
259261
build/AtomVM*

.github/workflows/codeql-analysis.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ name: "CodeQL"
88

99
on:
1010
push:
11+
tags-ignore:
12+
- '*-latest'
1113
paths-ignore:
1214
- 'src/platforms/emscripten/**'
1315
- 'src/platforms/esp32/**'

.github/workflows/esp32-build.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ name: ESP32 Builds
88

99
on:
1010
push:
11+
tags-ignore:
12+
- '*-latest'
1113
paths:
1214
- '.github/workflows/esp32-build.yaml'
1315
- 'CMakeLists.txt'

.github/workflows/esp32-mkimage.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,10 @@ jobs:
188188
uses: softprops/action-gh-release@v1
189189
if: startsWith(github.ref, 'refs/tags/')
190190
with:
191-
draft: true
191+
draft: ${{ !endsWith(github.ref_name, '-latest') }}
192+
prerelease: ${{ endsWith(github.ref_name, '-latest') }}
192193
fail_on_unmatched_files: true
194+
overwrite_files: ${{ endsWith(github.ref_name, '-latest') }}
193195
files: |
194196
src/platforms/esp32/build/AtomVM-${{ matrix.soc }}${{ matrix.flavor }}-${{ github.ref_name }}.img
195197
src/platforms/esp32/build/AtomVM-${{ matrix.soc }}${{ matrix.flavor }}-${{ github.ref_name }}.img.sha256

.github/workflows/esp32-simtest.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ name: ESP32 Sim test
99

1010
on:
1111
push:
12+
tags-ignore:
13+
- '*-latest'
1214
paths:
1315
- ".github/workflows/esp32-simtest.yaml"
1416
- "CMakeLists.txt"
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
#
2+
# Copyright 2026 AtomVM Contributors
3+
#
4+
# SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
5+
#
6+
# Maintainer notes:
7+
# - Requires RELEASE_TAG_PUSH_TOKEN (a fine-grained PAT).
8+
# - GitHub: Settings -> Developer settings -> Personal access tokens -> Fine-grained tokens.
9+
# - Grant it Contents: Read and write on atomvm/AtomVM.
10+
# - Add it with: gh secret set RELEASE_TAG_PUSH_TOKEN --repo atomvm/AtomVM
11+
# - Manual run: gh workflow run nightly-release-tags.yaml --repo atomvm/AtomVM --ref main
12+
# - Only if cleanup is needed, delete the stale release/tag and rerun:
13+
# gh release delete main-latest --repo atomvm/AtomVM --yes
14+
# Only for a complete cleanup, also delete the tag:
15+
# gh api -X DELETE repos/atomvm/AtomVM/git/refs/tags/main-latest
16+
17+
name: Nightly Release Tags
18+
19+
on:
20+
schedule:
21+
# Avoid the top of the hour when GitHub Actions is most congested.
22+
- cron: "17 2 * * *"
23+
workflow_dispatch:
24+
25+
permissions:
26+
contents: read
27+
28+
concurrency:
29+
group: ${{ github.workflow }}
30+
cancel-in-progress: false
31+
32+
jobs:
33+
update-nightly-tags:
34+
runs-on: ubuntu-24.04
35+
36+
strategy:
37+
fail-fast: false
38+
matrix:
39+
include:
40+
# Add one entry per branch that should publish a moving nightly tag.
41+
- branch: main
42+
tag: main-latest
43+
- branch: release-0.7
44+
tag: release-0.7-latest
45+
46+
env:
47+
# Use a PAT or GitHub App token that can push tags.
48+
# We intentionally do not use GITHUB_TOKEN here because downstream
49+
# release workflows should run when the nightly tag moves.
50+
TAG_PUSH_TOKEN: ${{ secrets.RELEASE_TAG_PUSH_TOKEN }}
51+
52+
steps:
53+
# In the official repository we fail fast if the secret is missing, so
54+
# nightly releases do not silently stop updating.
55+
- name: Require nightly tag token in official repository
56+
if: github.repository == 'atomvm/AtomVM' && env.TAG_PUSH_TOKEN == ''
57+
run: |
58+
echo "::error::Missing RELEASE_TAG_PUSH_TOKEN secret. Configure a token that can push tags and trigger downstream workflows."
59+
exit 1
60+
61+
# Forks can run this workflow manually without configuring the secret.
62+
# That makes it easier to verify the workflow wiring before enabling
63+
# real nightly tag updates in a test repository.
64+
- name: Skip nightly tag updates without token in forks
65+
if: github.repository != 'atomvm/AtomVM' && env.TAG_PUSH_TOKEN == ''
66+
run: echo "::warning::Skipping nightly tag update because RELEASE_TAG_PUSH_TOKEN is not configured in this fork."
67+
68+
- name: Checkout repository
69+
uses: actions/checkout@v4
70+
with:
71+
fetch-depth: 0
72+
persist-credentials: false
73+
74+
- name: Check remote branch exists
75+
id: branch
76+
shell: bash
77+
run: |
78+
if git ls-remote --exit-code origin "refs/heads/${{ matrix.branch }}" > /dev/null 2>&1; then
79+
echo "exists=true" >> "$GITHUB_OUTPUT"
80+
else
81+
echo "exists=false" >> "$GITHUB_OUTPUT"
82+
echo "::warning::Skipping missing branch ${{ matrix.branch }}"
83+
fi
84+
85+
- name: Update nightly tag
86+
if: env.TAG_PUSH_TOKEN != '' && steps.branch.outputs.exists == 'true'
87+
shell: bash
88+
run: |
89+
set -euo pipefail
90+
git fetch origin "${{ matrix.branch }}" --force
91+
git checkout --detach FETCH_HEAD
92+
git config user.name "github-actions[bot]"
93+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
94+
95+
BRANCH_HEAD="$(git rev-parse HEAD)"
96+
EXISTING_TAG="$(git ls-remote --tags origin "refs/tags/${{ matrix.tag }}^{}" | awk '{print $1}')"
97+
# Fall back to lightweight tag if the dereferenced form is missing.
98+
if [ -z "$EXISTING_TAG" ]; then
99+
EXISTING_TAG="$(git ls-remote --tags origin "refs/tags/${{ matrix.tag }}" | awk '{print $1}')"
100+
fi
101+
102+
if [ "$BRANCH_HEAD" = "$EXISTING_TAG" ]; then
103+
echo "Tag ${{ matrix.tag }} already points at ${BRANCH_HEAD:0:12} – nothing to do."
104+
exit 0
105+
fi
106+
107+
git tag -fa "${{ matrix.tag }}" -F - <<EOF
108+
Nightly build for ${{ matrix.branch }}
109+
110+
Commit: [${BRANCH_HEAD:0:12}](https://github.com/${{ github.repository }}/commit/${BRANCH_HEAD})
111+
Change log: [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/${BRANCH_HEAD}/CHANGELOG.md)
112+
Branch history: [${{ matrix.branch }}](https://github.com/${{ github.repository }}/commits/${{ matrix.branch }})
113+
EOF
114+
115+
git remote set-url origin "https://x-access-token:${TAG_PUSH_TOKEN}@github.com/${{ github.repository }}.git"
116+
git push origin "refs/tags/${{ matrix.tag }}" --force

.github/workflows/pico-build.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,11 @@ jobs:
156156
echo "/opt/riscv32-toolchain/bin" >> $GITHUB_PATH
157157
158158
- name: "Git config safe.directory for codeql"
159+
if: ${{ !(startsWith(github.ref, 'refs/tags/') && endsWith(github.ref_name, '-latest')) }}
159160
run: git config --global --add safe.directory /__w/AtomVM/AtomVM
160161

161162
- name: "Initialize CodeQL"
163+
if: ${{ !(startsWith(github.ref, 'refs/tags/') && endsWith(github.ref_name, '-latest')) }}
162164
uses: github/codeql-action/init@v4
163165
with:
164166
languages: "cpp"
@@ -176,6 +178,7 @@ jobs:
176178
cmake --build . --target=AtomVM
177179
178180
- name: "Perform CodeQL Analysis"
181+
if: ${{ !(startsWith(github.ref, 'refs/tags/') && endsWith(github.ref_name, '-latest')) }}
179182
uses: github/codeql-action/analyze@v4
180183

181184
- name: Install nvm and nodejs 20
@@ -256,8 +259,10 @@ jobs:
256259
uses: softprops/action-gh-release@v1
257260
if: startsWith(github.ref, 'refs/tags/') && matrix.board != 'pico_w' && matrix.board != 'pico2_w' && matrix.platform == '' && matrix.jit == ''
258261
with:
259-
draft: true
262+
draft: ${{ !endsWith(github.ref_name, '-latest') }}
263+
prerelease: ${{ endsWith(github.ref_name, '-latest') }}
260264
fail_on_unmatched_files: true
265+
overwrite_files: ${{ endsWith(github.ref_name, '-latest') }}
261266
files: |
262267
src/platforms/rp2/build/src/AtomVM-${{ matrix.board }}-${{ github.ref_name }}.uf2
263268
src/platforms/rp2/build/src/AtomVM-${{ matrix.board }}-${{ github.ref_name }}.uf2.sha256
@@ -270,8 +275,10 @@ jobs:
270275
uses: softprops/action-gh-release@v1
271276
if: startsWith(github.ref, 'refs/tags/') && (matrix.board == 'pico_w' || matrix.board == 'pico2_w') && matrix.platform == '' && matrix.jit == ''
272277
with:
273-
draft: true
278+
draft: ${{ !endsWith(github.ref_name, '-latest') }}
279+
prerelease: ${{ endsWith(github.ref_name, '-latest') }}
274280
fail_on_unmatched_files: true
281+
overwrite_files: ${{ endsWith(github.ref_name, '-latest') }}
275282
files: |
276283
src/platforms/rp2/build/src/AtomVM-${{ matrix.board }}-${{ github.ref_name }}.uf2
277284
src/platforms/rp2/build/src/AtomVM-${{ matrix.board }}-${{ github.ref_name }}.uf2.sha256

.github/workflows/publish-docs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
# Triggers the workflow on pull request, tag events and pushes on main
1414
push:
1515
tags:
16-
- '**'
16+
- 'v*'
1717
branches:
1818
- 'main'
1919
- 'release-**'

.github/workflows/stm32-build.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ name: STM32 Build
88

99
on:
1010
push:
11+
tags-ignore:
12+
- '*-latest'
1113
paths:
1214
- '.github/workflows/stm32-build.yaml'
1315
- 'CMakeLists.txt'

0 commit comments

Comments
 (0)