Skip to content

Commit

Permalink
[wallet-ext] Workflow run wallet extension (#4766)
Browse files Browse the repository at this point in the history
* Workflow run wallet extension

* Fix lint

* Update workflow to hopefully work

* Remove test change
  • Loading branch information
Jordan-Mysten authored Sep 26, 2022
1 parent 110dd6d commit aa469e4
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 11 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/wallet-ext-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Wallet Extension PR Comment

# NOTE: This workflow run indirection is used to securely comment on PRs when
# wallet builds are completed.
on:
workflow_run:
workflows: ["Wallet Extension PR Checks"]
types:
- completed

jobs:
upload:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
steps:
- name: "Download artifact"
uses: actions/github-script@v6
id: get-artifact
with:
result-encoding: string
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "wallet-extension"
})[0];
if (!matchArtifact) {
return '';
}
return matchArtifact.archive_download_url;
- name: Comment PR
uses: thollander/actions-comment-pull-request@v1
if: steps.get-artifact.outputs.result != ''
with:
comment_includes: "💳 Wallet Extension"
message: |
💳 Wallet Extension has been built, you can download the packaged extension here: ${{steps.get-artifact.outputs.result}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15 changes: 4 additions & 11 deletions .github/workflows/wallet-ext-prs.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
name: Wallet Extension PR checks
name: Wallet Extension PR Checks
on: pull_request
jobs:
diff:
runs-on: [ubuntu-latest]
runs-on: ubuntu-latest
outputs:
isWalletExt: ${{ steps.diff.outputs.isWalletExt }}
steps:
- uses: actions/checkout@v3
- name: Detect Changes
uses: "./.github/actions/pnpm-diffs"
id: diff

run_checks:
name: Lint, Test & Build
needs: diff
if: needs.diff.outputs.isWalletExt == 'true'
runs-on: [ubuntu-latest]
runs-on: ubuntu-latest
env:
working-directory: ./wallet
steps:
Expand Down Expand Up @@ -43,16 +44,8 @@ jobs:
working-directory: ${{env.working-directory}}
run: pnpm pack:zip
- uses: actions/upload-artifact@v2
if: always()
with:
name: wallet-extension
path: wallet/web-ext-artifacts/*
if-no-files-found: error
retention-days: 7
- name: Comment PR
uses: thollander/actions-comment-pull-request@v1
with:
comment_includes: "💳 Wallet Extension"
message: |
💳 Wallet Extension has been built, you can download the packaged extension here: https://github.com/MystenLabs/sui/actions/runs/${{ github.run_id }}#artifacts
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit aa469e4

Please sign in to comment.