release: harden upload pipeline (TAG/VER split, --fail-with-body, GITHUB_TOKEN, contents:write)

Aligns with the chip-plugin repos:
- Use TAG (with v prefix) for gh release create, VER (stripped) for
  Changelist lookup and upload.php's version field.
- curl --fail-with-body so server-side errors fail the workflow instead of
  passing silently.
- Switch GH_TOKEN to the auto-provided GITHUB_TOKEN with explicit
  contents:write permission, dropping the dependency on a per-repo
  ACCESS_TOKEN PAT.
This commit is contained in:
Roland Rabien 2026-04-30 09:25:23 -07:00
commit 098a5f3303
3 changed files with 11 additions and 6 deletions

View file

@ -67,6 +67,8 @@ jobs:
needs: build needs: build
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 30 timeout-minutes: 30
permissions:
contents: write
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Download Artifacts - name: Download Artifacts
@ -75,5 +77,5 @@ jobs:
run: ./release.sh run: ./release.sh
shell: bash shell: bash
env: env:
GH_TOKEN: ${{ secrets.ACCESS_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
APIKEY: ${{ secrets.APIKEY }} APIKEY: ${{ secrets.APIKEY }}

View file

@ -4,7 +4,10 @@ set -x
cd "$(dirname "$0")" cd "$(dirname "$0")"
ROOT=$(pwd) ROOT=$(pwd)
VER="$GITHUB_REF_NAME" TAG="$GITHUB_REF_NAME"
# Tags are pushed with a leading "v" (see tag.sh); strip for the changelog
# lookup and the upload.php version field, but use TAG for gh release create.
VER="${TAG#v}"
# Extract the changelog section for the current version # Extract the changelog section for the current version
# Matches version with optional colon, captures until the next version line or EOF # Matches version with optional colon, captures until the next version line or EOF
@ -32,13 +35,13 @@ if [ -f "./Binaries macOS/Symbols_Mac.zip" ]; then
ASSETS+=("./Binaries macOS/Symbols_Mac.zip") ASSETS+=("./Binaries macOS/Symbols_Mac.zip")
fi fi
gh release create "$VER" --title "$VER" -F /tmp/release_notes.txt "${ASSETS[@]}" gh release create "$TAG" --title "$TAG" -F /tmp/release_notes.txt "${ASSETS[@]}"
PLUGIN=wavetable PLUGIN=wavetable
for f in "./Binaries Linux"/*.deb \ for f in "./Binaries Linux"/*.deb \
"./Binaries Windows"/*.exe \ "./Binaries Windows"/*.exe \
"./Binaries macOS"/*.pkg; do "./Binaries macOS"/*.pkg; do
curl -sS -F "files=@${f}" \ curl -sS --fail-with-body -F "files=@${f}" \
-F "plugin=${PLUGIN}" \ -F "plugin=${PLUGIN}" \
-F "version=${VER}" \ -F "version=${VER}" \
-F "changelog=${NOTES}" \ -F "changelog=${NOTES}" \

4
tag.sh
View file

@ -13,5 +13,5 @@ if ! grep -q "^${VER}:*$" Changelist.txt; then
exit 1 exit 1
fi fi
echo "Tagging [$VER]" echo "Tagging [v$VER]"
git tag "$VER" && git push origin "$VER" git tag "v$VER" && git push origin "v$VER"