-
Notifications
You must be signed in to change notification settings - Fork 88
91 lines (82 loc) · 3.1 KB
/
prerelease-fork.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Canary release from fork
concurrency:
group: ${{ github.workflow }}-${{ github.event.workflow_run.id }}
cancel-in-progress: true
on:
workflow_run:
workflows: ['Build PR From Fork']
types: ['completed']
branches-ignore: ['master']
jobs:
prepare_jobs:
runs-on: ubuntu-latest
if: |
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
outputs:
pr_commit_sha: '${{ steps.set_pr_info.outputs.pr_commit_sha }}'
pr_number: '${{ steps.set_pr_info.outputs.pr_number }}'
steps:
- name: Download PR info
uses: dawidd6/action-download-artifact@575b1e4167df67acf7e692af784566618b23c71e # v2.17.0
with:
workflow: build-fork.yml
run_id: '${{ github.event.workflow_run.id }}'
workflow_conclusion: success
name: pr
path: ./
- name: Set PR info
id: set_pr_info
shell: sh
run: |
echo "::set-output name=pr_commit_sha::$(cat SHA | tr -dc 'a-f0-9' | head -c40)"
echo "::set-output name=pr_number::$(cat NUM | tr -dc '[:digit:]')"
prerelease:
runs-on: ubuntu-latest
needs: ['prepare_jobs']
env:
pr_commit_sha: '${{ needs.prepare_jobs.outputs.pr_commit_sha }}'
pr_number: '${{ needs.prepare_jobs.outputs.pr_number }}'
steps:
- uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # v3.0.0
with:
token: '${{ secrets.BOT_TOKEN }}'
- name: Download math-utils build
uses: dawidd6/action-download-artifact@575b1e4167df67acf7e692af784566618b23c71e # v2.17.0
with:
workflow: build-fork.yml
run_id: '${{ github.event.workflow_run.id }}'
workflow_conclusion: success
name: math-utils
path: packages/math-utils/dist
- name: Download contract-helpers build
uses: dawidd6/action-download-artifact@575b1e4167df67acf7e692af784566618b23c71e # v2.17.0
with:
workflow: build-fork.yml
run_id: '${{ github.event.workflow_run.id }}'
workflow_conclusion: success
name: contract-helpers
path: packages/contract-helpers/dist
- name: prerelease
shell: bash
run: |
yarn release:canary \
--yes --no-verify-access \
--dist-tag "${pr_commit_sha}" --preid "${pr_commit_sha}" \
| tee __publish-log.txt
- name: Comment on PR
if: success()
uses: ./.github/actions/pr-comment
with:
PR_NUMBER: '${{ env.pr_number }}'
- name: Notify about failure
if: failure()
uses: actions/github-script@9ac08808f993958e9de277fe43a64532a609130e # v6.0.0
with:
script: |
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: Number('${{ env.pr_number }}'),
body: '❌ Something went wrong with canary release\nPlease see logs at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
});