From fae45fc684fb93777c8fa0819aa1c832c65ee7f0 Mon Sep 17 00:00:00 2001 From: Tim Man Date: Wed, 5 Jul 2023 13:24:00 +0800 Subject: [PATCH] chore: add artifact upload and comment on PR to build workflow --- .github/workflows/build.yml | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 69557eea8..c3d62d130 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,16 +2,15 @@ name: Build on: pull_request: - branches: [ main, develop ] + branches: [main, develop] jobs: build: - runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Use Node.js + - name: Use Node.js uses: actions/setup-node@v3 with: always-auth: true @@ -25,4 +24,24 @@ jobs: - name: Build run: npm run build --if-present # - name: Test - # run: npm test --passWithNoTests + # run: npm test --passWithNoTests + - name: Save Filename + id: save-filename + run: | + echo "FILENAME=xverse-extension.$(echo ${{github.ref_name}}| sed 's/\//-/').$(git rev-parse --short ${{ github.sha }}).zip" >> $GITHUB_OUTPUT + - name: Create Archive + run: | + zip -r build.zip ./build + - name: Upload Archive + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.save-filename.outputs.FILENAME }} + path: build.zip + if-no-files-found: error + - name: Comment to PR + uses: gavv/pull-request-artifacts@v1.0.0 + with: + commit: ${{ github.event.pull_request.head.sha }} + repo-token: ${{ secrets.GITHUB_TOKEN }} + artifacts: | + ${{ steps.save-filename.outputs.FILENAME }}