@@ -3,20 +3,33 @@ name: Pre-release
33on :
44 push :
55 branches : [main]
6+ # Skip pre-release for changes that don't affect the built artifact.
7+ paths-ignore :
8+ - ' **.md'
9+ - ' .github/dependabot.yml'
10+ - ' .github/ISSUE_TEMPLATE/**'
11+ - ' .github/PULL_REQUEST_TEMPLATE/**'
12+ - ' .coderabbit.yaml'
13+ - ' .gitleaks.toml'
14+ - ' .pre-commit-config.yaml'
15+ - ' .yamllint.yml'
16+ - ' .gitignore'
17+ - ' LICENSE'
618
719permissions :
820 contents : write
921
1022jobs :
1123 prerelease :
1224 runs-on : ubuntu-latest
25+ timeout-minutes : 10
1326 steps :
1427 - uses : actions/checkout@v6
1528 with :
1629 fetch-depth : 0
17- - uses : actions/setup-node@v4
30+ - uses : actions/setup-node@v6
1831 with :
19- node-version : 22.22 .0
32+ node-version : 24.14 .0
2033 cache : npm
2134
2235 - name : Get current version
@@ -29,31 +42,44 @@ jobs:
2942 id : prerelease
3043 env :
3144 BASE_VERSION : ${{ steps.version.outputs.version }}
45+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
46+ REPO : ${{ github.repository }}
3247 run : |
33- LATEST=$(git tag -l "v${BASE_VERSION}-pre.*" --sort=-version:refname | head -n1)
48+ # Derive the next number from existing RELEASES (incl. drafts + already
49+ # published immutable releases), NOT git tags. Under immutable releases a
50+ # pre-release tag can be permanently reserved in the release ledger while
51+ # never materializing as a git ref, so git-tag-based numbering collides on
52+ # the same number every run. The releases list always reflects burned tags.
53+ LATEST=$(gh api "repos/${REPO}/releases" --paginate \
54+ --jq ".[].tag_name | select(startswith(\"v${BASE_VERSION}-pre.\"))" \
55+ | sed "s|^v${BASE_VERSION}-pre.||" | sort -n | tail -n1)
3456 if [ -z "$LATEST" ]; then
3557 NUM=1
3658 else
37- NUM=$(echo "$LATEST" | sed "s/v${BASE_VERSION}-pre\.\([0-9]*\)/\1/")
38- NUM=$((NUM + 1))
59+ NUM=$((LATEST + 1))
3960 fi
4061 TAG="v${BASE_VERSION}-pre.${NUM}"
4162 echo "tag=$TAG" >> "$GITHUB_OUTPUT"
4263
4364 - run : npm ci
4465 - run : npm run build
45- - run : cp dist/index.html compose-sanitizer .html
66+ - run : cp dist/index.html docker- compose-debugger .html
4667
47- - name : Create pre-release tag
48- env :
49- TAG : ${{ steps.prerelease.outputs.tag }}
50- run : |
51- git tag "$TAG"
52- git push origin "$TAG"
5368
69+ # The repo has immutable releases enabled. softprops/action-gh-release
70+ # creates and publishes in one step, which means the asset upload races
71+ # against the immutable lockdown and fails. Create as draft, upload the
72+ # asset, then publish in a follow-up step.
5473 - uses : softprops/action-gh-release@v2
5574 with :
5675 tag_name : ${{ steps.prerelease.outputs.tag }}
57- files : compose-sanitizer .html
76+ files : docker- compose-debugger .html
5877 generate_release_notes : true
5978 prerelease : true
79+ draft : true
80+
81+ - name : Publish pre-release
82+ env :
83+ TAG : ${{ steps.prerelease.outputs.tag }}
84+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
85+ run : gh release edit "$TAG" --repo "${{ github.repository }}" --draft=false
0 commit comments