|
5 | 5 | tags: ["v*"] |
6 | 6 |
|
7 | 7 | jobs: |
| 8 | + preflight: |
| 9 | + name: Preflight Checks |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v6 |
| 13 | + |
| 14 | + - name: Check wally.toml version matches tag |
| 15 | + run: | |
| 16 | + TAG="${{ github.ref_name }}" |
| 17 | + WALLY_VERSION="v$(grep -m1 '^version' wally.toml | sed 's/.*"\(.*\)".*/\1/')" |
| 18 | + if [ "$WALLY_VERSION" != "$TAG" ]; then |
| 19 | + echo "::error::wally.toml version ($WALLY_VERSION) does not match tag ($TAG). Update the version in wally.toml before releasing." |
| 20 | + exit 1 |
| 21 | + fi |
| 22 | +
|
| 23 | + - name: Check CHANGELOG.md has entry for this version |
| 24 | + run: | |
| 25 | + TAG="${{ github.ref_name }}" |
| 26 | + if ! grep -q "^# $TAG" CHANGELOG.md; then |
| 27 | + echo "::error::No changelog entry found for $TAG in CHANGELOG.md. Add a '# $TAG' section before releasing." |
| 28 | + exit 1 |
| 29 | + fi |
| 30 | +
|
8 | 31 | create-release: |
9 | 32 | name: Create Release |
| 33 | + needs: preflight |
10 | 34 | runs-on: ubuntu-latest |
11 | 35 | permissions: |
12 | 36 | contents: write |
@@ -34,13 +58,28 @@ jobs: |
34 | 58 | exit 1 |
35 | 59 | fi |
36 | 60 |
|
| 61 | + # Strip leading 'v' for wally version URL |
| 62 | + VERSION="${TAG#v}" |
| 63 | + WALLY_URL="https://wally.run/package/cameronpcampbell/typeforge?version=${VERSION}" |
| 64 | +
|
| 65 | + cat > /tmp/release_body.md << EOF |
| 66 | + # Changelog |
| 67 | + ${CHANGELOG} |
| 68 | +
|
| 69 | + --- |
| 70 | +
|
| 71 | + # Wally |
| 72 | + Install via [Wally](${WALLY_URL}): |
| 73 | + \`\`\`toml |
| 74 | + typeforge = "cameronpcampbell/typeforge@${VERSION}" |
| 75 | + \`\`\` |
| 76 | + EOF |
| 77 | +
|
37 | 78 | if gh release view "$TAG" > /dev/null 2>&1; then |
38 | | - echo "Release $TAG already exists. Updating with changelog." |
39 | | - printf '%s\n' "$CHANGELOG" > /tmp/release_body.md |
40 | | - gh release edit "$TAG" --title "$TAG" --notes-file /tmp/release_body.md |
| 79 | + echo "Release $TAG already exists. Updating." |
| 80 | + gh release edit "$TAG" --draft --title "Typeforge $TAG" --notes-file /tmp/release_body.md |
41 | 81 | else |
42 | | - printf '%s\n' "$CHANGELOG" > /tmp/release_body.md |
43 | | - gh release create "$TAG" --verify-tag --title "$TAG" --notes-file /tmp/release_body.md |
| 82 | + gh release create "$TAG" --draft --verify-tag --title "Typeforge $TAG" --notes-file /tmp/release_body.md |
44 | 83 | fi |
45 | 84 |
|
46 | 85 | - name: Rokit Cache Restore |
|
57 | 96 | - name: Install Tools |
58 | 97 | run: | |
59 | 98 | export PATH="$HOME/.rokit/bin:$PATH" |
60 | | - rokit install --trust-all |
| 99 | + rokit trust UpliftGames/wally |
| 100 | + rokit install |
61 | 101 |
|
62 | 102 | - name: Rokit Cache Save |
63 | 103 | if: always() |
|
75 | 115 | "https://api.wally.run/" = "${{ secrets.WALLY_TOKEN }}" |
76 | 116 | EOF |
77 | 117 | wally publish |
| 118 | +
|
| 119 | + - name: Publish Release |
| 120 | + env: |
| 121 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 122 | + run: gh release edit "${{ github.ref_name }}" --draft=false |
0 commit comments