Skip to content

Commit

Permalink
Fix build-and-release github action
Browse files Browse the repository at this point in the history
  • Loading branch information
wigginno committed Aug 28, 2024
1 parent 7611bc3 commit 200f85e
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,16 @@ jobs:
- name: Build WebAssembly
run: wasm-pack build --target web

- name: Create or update release
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
release_info=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/${{ github.repository }}/releases/latest")
if [ "$(echo "$release_info" | jq -r '.tag_name')" != "latest" ]; then
response=$(curl -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
-d '{"tag_name": "latest", "name": "Latest Release", "body": "This is the latest release of the WebAssembly module.", "draft": false, "prerelease": false}' \
"https://api.github.com/repos/${{ github.repository }}/releases")
else
release_id=$(echo "$release_info" | jq -r '.id')
response=$(curl -X PATCH \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
-d '{"body": "This is the latest release of the WebAssembly module."}' \
"https://api.github.com/repos/${{ github.repository }}/releases/$release_id")
fi
echo "upload_url=$(echo "$response" | jq -r .upload_url | sed -e 's/{?name,label}//')" >> $GITHUB_OUTPUT
with:
tag_name: v${{ github.run_number }}
release_name: Release ${{ github.run_number }}
draft: false
prerelease: false

- name: Upload WebAssembly Module
uses: actions/upload-release-asset@v1
Expand Down

0 comments on commit 200f85e

Please sign in to comment.