From f33f63a341c916adff1fe3b77f80a36887d00aa2 Mon Sep 17 00:00:00 2001 From: Noah Wiggin Date: Wed, 28 Aug 2024 11:44:29 -0400 Subject: [PATCH] Fix build-and-release github action --- .github/workflows/build-and-release.yml | 54 +++++-------------------- 1 file changed, 9 insertions(+), 45 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index b18dadd..b51b893 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -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