11name : Package Neuron for Test
22
3- on : [push]
3+ on :
4+ issue_comment :
5+ types : [created, edited]
6+ push :
47
58jobs :
69 packaging :
10+ if : ${{ (github.event_name == 'issue_comment' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/package')) || github.event_name == 'push' }}
11+
712 strategy :
813 matrix :
914 node :
@@ -17,20 +22,31 @@ jobs:
1722
1823 name : ${{ matrix.os }}(Node.js ${{ matrix.node }})
1924
25+ env :
26+ MAC_SHOULD_CODE_SIGN : ${{ github.event_name != 'pull_request' && secrets.APPLE_ID != '' }}
27+ WIN_CERTIFICATE_BASE64 : ${{ secrets.WIN_CERTIFICATE_BASE64 }}
28+
2029 steps :
2130 - name : Set git to use LF
2231 run : |
2332 git config --global core.autocrlf false
2433 git config --global core.eol lf
2534
26- - name : Checkout
35+ - name : Checkout for push
36+ uses : actions/checkout@v3
37+ if : ${{ github.event_name == 'push' }}
38+
39+ - name : Checkout for PR
2740 uses : actions/checkout@v3
41+ if : ${{ github.event_name == 'issue_comment' }}
42+ with :
43+ ref : refs/pull/${{ github.event.issue.number }}/merge
2844
2945 - name : Setup Node
3046 uses : actions/setup-node@v3
3147 with :
3248 node-version : ${{ matrix.node }}
33- cache : ' yarn'
49+ cache : " yarn"
3450
3551 - name : Restore
3652 uses : actions/cache@v3
4460 if : matrix.os == 'windows-2019'
45614662 env :
47- ACTIONS_ALLOW_UNSECURE_COMMANDS : ' true'
63+ ACTIONS_ALLOW_UNSECURE_COMMANDS : " true"
4864
4965 - name : Install libudev
5066 if : matrix.os == 'ubuntu-20.04'
@@ -55,14 +71,14 @@ jobs:
5571 - name : Install Lerna
5672 run : yarn global add lerna
5773
58- - name : Boostrap
74+ - name : Bootstrap
5975 run : |
6076 yarn
6177 env :
6278 CI : false
6379
6480 - name : Package for MacOS
65- if : matrix.os == 'macos-latest'
81+ if : ${{ matrix.os == 'macos-latest' && env.MAC_SHOULD_CODE_SIGN == 'true' }}
6682 run : |
6783 ./scripts/download-ckb.sh mac
6884 yarn package:test mac
7288 APPLE_ID_PASSWORD : ${{ secrets.APPLE_ID_PASSWORD }}
7389 CSC_LINK : ${{ secrets.MAC_CERTIFICATE_BASE64 }}
7490 CSC_KEY_PASSWORD : ${{ secrets.MAC_CERTIFICATE_PASSWORD }}
91+ TEAM_ID : ${{ secrets.TEAM_ID }}
92+
93+ - name : Package for MacOS for skip code sign
94+ if : ${{ matrix.os == 'macos-latest' && env.MAC_SHOULD_CODE_SIGN == 'false' }}
95+ run : |
96+ export CSC_IDENTITY_AUTO_DISCOVERY=false
97+ ./scripts/download-ckb.sh mac
98+ yarn package:test mac
99+ env :
100+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
101+ SKIP_NOTARIZE : true
75102
76103 - name : Package for Windows
77- if : matrix.os == 'windows-2019'
104+ if : ${{ matrix.os == 'windows-2019' && env.WIN_CERTIFICATE_BASE64 != '' }}
78105 run : |
79106 bash ./scripts/download-ckb.sh win
80107 yarn build
@@ -85,6 +112,16 @@ jobs:
85112 CSC_LINK : ${{ secrets.WIN_CERTIFICATE_BASE64 }}
86113 CSC_KEY_PASSWORD : ${{ secrets.WIN_CERTIFICATE_PASSWORD }}
87114
115+ - name : Package for Windows for skip code sign
116+ if : ${{ matrix.os == 'windows-2019' && env.WIN_CERTIFICATE_BASE64 == '' }}
117+ run : |
118+ bash ./scripts/download-ckb.sh win
119+ yarn build
120+ bash ./scripts/copy-ui-files.sh
121+ bash ./scripts/package-for-test.sh win
122+ env :
123+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
124+
88125 - name : Package for Linux
89126 if : matrix.os == 'ubuntu-20.04'
90127 run : |
@@ -135,12 +172,37 @@ jobs:
135172 name : Neuron-Linux
136173 path : release/Neuron-*.AppImage
137174
138- comment :
175+ comment_when_package_success :
139176 needs : [packaging]
140177 name : Append links to the Pull Request
141178 runs-on : ubuntu-latest
142179 steps :
143- - uses : peter-evans/commit-comment@v2
180+ - name : Comment by push event
181+ if : ${{ github.event_name == 'push' }}
182+ uses : peter-evans/commit-comment@v2
144183 with :
145184 body : |
146185 Packaging for test is done in [${{ github.run_id }}](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})
186+
187+ - name : Comment by pull request comment event
188+ if : ${{ github.event_name == 'issue_comment' }}
189+ uses : peter-evans/create-or-update-comment@v3
190+ with :
191+ comment-id : ${{ github.event.comment.id }}
192+ body : |
193+ Packaging for test is done in [${{ github.run_id }}](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}). @${{ github.event.comment.user.login }}
194+ edit-mode : append
195+
196+ comment_when_package_failed :
197+ needs : [packaging]
198+ if : ${{ always() && needs.packaging.result == 'failure' }}
199+ name : Append failed comment to the comment
200+ runs-on : ubuntu-latest
201+ steps :
202+ - name : Comment by pull request comment event when package failed
203+ if : ${{ github.event_name == 'issue_comment' }}
204+ uses : peter-evans/create-or-update-comment@v3
205+ with :
206+ comment-id : ${{ github.event.comment.id }}
207+ body : Packageing failed in [${{ github.run_id }}](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}). @${{ github.event.comment.user.login }}
208+ edit-mode : append
0 commit comments