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 ac202b6 commit f33f63a
Showing 1 changed file with 9 additions and 45 deletions.
54 changes: 9 additions & 45 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,51 +25,15 @@ jobs:
- name: Build
run: wasm-pack build --target web

- name: Get or create release
id: get_or_create_release
uses: actions/github-script@v6
- name: Update Release
uses: softprops/action-gh-release@v1
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
try {
const release = await github.rest.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: 'latest'
});
return release.data;
} catch (error) {
if (error.status === 404) {
const newRelease = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: 'latest',
name: 'Latest Release',
body: 'This is the latest release of the WebAssembly module.',
draft: false,
prerelease: false
});
return newRelease.data;
}
throw error;
}
- name: Upload WebAssembly Module
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ fromJson(steps.get_or_create_release.outputs.result).upload_url }}
asset_path: ./pkg/gsea_rs_bg.wasm
asset_name: gsea_rs_bg.wasm
asset_content_type: application/wasm

- name: Upload JavaScript Wrapper
uses: actions/upload-release-asset@v1
tag_name: latest
name: Latest Release
files: |
pkg/gsea_rs_bg.wasm
pkg/gsea_rs.js
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ fromJson(steps.get_or_create_release.outputs.result).upload_url }}
asset_path: ./pkg/gsea_rs.js
asset_name: gsea_rs.js
asset_content_type: application/javascript

0 comments on commit f33f63a

Please sign in to comment.