Compare commits

1 Commits

Author SHA1 Message Date
Christian 0ce7fcca72 Add a release workflow that publishes zips on tag push
Pushing a v* tag builds portage-chrome-<version>.zip and
portage-firefox-<version>.zip with git archive (manifest.json at the
root, same as the store uploads) and publishes a GitHub release using
the tag's message as notes. It fails if either manifest's version
doesn't match the tag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 06:25:15 -04:00
+42
View File
@@ -0,0 +1,42 @@
name: Release
# Push a tag like v2.1.1 to publish a GitHub release with both store-ready zips.
# The release notes come from the annotated tag's message.
on:
push:
tags: ['v*']
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch the annotated tag
run: git fetch --force --tags origin
- name: Check manifest versions match the tag
run: |
version="${GITHUB_REF_NAME#v}"
for browser in chrome firefox; do
found=$(node -p "require('./$browser/manifest.json').version")
if [ "$found" != "$version" ]; then
echo "::error::$browser/manifest.json is $found, but the tag is $GITHUB_REF_NAME"
exit 1
fi
done
- name: Build zips (manifest.json at the root)
run: |
version="${GITHUB_REF_NAME#v}"
git archive --format=zip -9 -o "portage-chrome-$version.zip" "$GITHUB_REF_NAME:chrome"
git archive --format=zip -9 -o "portage-firefox-$version.zip" "$GITHUB_REF_NAME:firefox"
unzip -l "portage-chrome-$version.zip"
unzip -l "portage-firefox-$version.zip"
- name: Publish release
env:
GH_TOKEN: ${{ github.token }}
run: |
version="${GITHUB_REF_NAME#v}"
gh release create "$GITHUB_REF_NAME" \
"portage-chrome-$version.zip" "portage-firefox-$version.zip" \
--title "Portage $version" --notes-from-tag --latest