2828 steps :
2929 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
3030
31+ # Validate that the git tag version matches Cargo.toml to prevent
32+ # mismatched artifact names vs Homebrew URLs (see package.sh line 9).
33+ - name : Validate tag matches Cargo.toml version
34+ run : |
35+ TAG_VERSION="${GITHUB_REF#refs/tags/penpal/v}"
36+ CARGO_VERSION=$(grep '^version' apps/penpal/frontend/src-tauri/Cargo.toml | head -1 | sed 's/version = "//;s/"//')
37+ if [ "$TAG_VERSION" != "$CARGO_VERSION" ]; then
38+ echo "::error::Tag version ($TAG_VERSION) does not match Cargo.toml version ($CARGO_VERSION)"
39+ exit 1
40+ fi
41+
3142 # Install hermit (manages node, rust, just, go)
3243 - uses : cashapp/activate-hermit@e49f5cb4dd64ff0b0b659d1d8df499595451155a # v1
3344
@@ -98,25 +109,31 @@ jobs:
98109 path : artifacts
99110 merge-multiple : true
100111
101- # Extract version from tag
112+ # Extract version from tag and validate semver format
102113 - name : Extract version
103114 id : version
104115 run : |
105116 TAG="${GITHUB_REF#refs/tags/penpal/v}"
117+ if [[ ! "$TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ ]]; then
118+ echo "::error::Tag version '$TAG' does not match semver format"
119+ exit 1
120+ fi
106121 echo "version=$TAG" >> "$GITHUB_OUTPUT"
107122
108123 # Create GitHub Release with both zips
109124 - name : Create GitHub Release
110125 env :
111126 GH_TOKEN : ${{ github.token }}
127+ VERSION : ${{ steps.version.outputs.version }}
128+ TAG_NAME : penpal/v${{ steps.version.outputs.version }}
112129 run : |
113130 PREV_TAG=$(git describe --tags --match 'penpal/v*' --abbrev=0 HEAD^ 2>/dev/null || echo "")
114131 NOTES_ARGS="--generate-notes"
115132 if [ -n "$PREV_TAG" ]; then
116133 NOTES_ARGS="$NOTES_ARGS --notes-start-tag $PREV_TAG"
117134 fi
118- gh release create "${{ github.ref_name }} " \
119- --title "Penpal v${{ steps.version.outputs.version } }" \
135+ gh release create "$TAG_NAME " \
136+ --title "Penpal v${VERSION }" \
120137 $NOTES_ARGS \
121138 artifacts/*.zip
122139
@@ -126,8 +143,8 @@ jobs:
126143 - name : Trigger Homebrew cask bump
127144 env :
128145 GH_TOKEN : ${{ github.token }}
146+ VERSION : ${{ steps.version.outputs.version }}
129147 run : |
130- VERSION="${{ steps.version.outputs.version }}"
131148 BASE_URL="https://github.com/block/builderbot/releases/download/penpal/v${VERSION}"
132149 gh workflow run bump-cask.yaml \
133150 -R block/homebrew-tap \
0 commit comments