ci: delegate release publication to stoke
This commit is contained in:
parent
571e1b1f1f
commit
ee88d7d395
2 changed files with 3 additions and 17 deletions
|
|
@ -37,20 +37,5 @@ jobs:
|
||||||
|
|
||||||
- name: Create release and attach .deb
|
- name: Create release and attach .deb
|
||||||
env:
|
env:
|
||||||
TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||||
TAG: ${{ github.ref_name }}
|
run: bash scripts/publish-release.sh "${{ github.ref_name }}" "$(node -p "require('./package.json').version")" "$(ls dist/stoke_*_all.deb)" "${{ github.repository_owner }}" stoke
|
||||||
API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
DEB=$(ls dist/stoke_*_all.deb)
|
|
||||||
# Create the release if it does not exist yet, then grab its id.
|
|
||||||
RELEASE_ID=$(curl -sf -H "Authorization: token $TOKEN" "$API/releases/tags/$TAG" | node -pe "JSON.parse(require('fs').readFileSync(0,'utf8')).id" 2>/dev/null || true)
|
|
||||||
if [ -z "$RELEASE_ID" ]; then
|
|
||||||
RELEASE_ID=$(curl -sf -X POST -H "Authorization: token $TOKEN" -H 'Content-Type: application/json' \
|
|
||||||
-d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"draft\":false,\"prerelease\":false}" \
|
|
||||||
"$API/releases" | node -pe "JSON.parse(require('fs').readFileSync(0,'utf8')).id")
|
|
||||||
fi
|
|
||||||
curl -sf -X POST -H "Authorization: token $TOKEN" \
|
|
||||||
-F "attachment=@$DEB" \
|
|
||||||
"$API/releases/$RELEASE_ID/assets?name=$(basename "$DEB")" >/dev/null
|
|
||||||
echo "Attached $(basename "$DEB") to release $TAG"
|
|
||||||
|
|
|
||||||
1
changelog.d/54.md
Normal file
1
changelog.d/54.md
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
- Publish release assets and the matching changelog section through stoke's credential-safe CLI. (#54).
|
||||||
Loading…
Reference in a new issue