14
14
defaults :
15
15
run :
16
16
working-directory : react-static-web-apps-auth
17
+ environment :
18
+ name : build
19
+ url : ${{ steps.create_release.outputs.html_url }}
17
20
steps :
18
21
- uses : actions/checkout@v2
19
22
- name : Create Release
@@ -24,49 +27,92 @@ jobs:
24
27
with :
25
28
tag_name : ${{ github.ref }}
26
29
release_name : Release ${{ github.ref }}
27
- draft : false
30
+ draft : true
28
31
prerelease : false
29
32
- uses : actions/setup-node@v1
30
33
with :
31
34
node-version : ${{ env.NODE_VERSION }}
32
- - run : npm ci
33
- - run : npm run lint
34
- - run : npm run build
35
+ - run : |
36
+ npm ci
37
+ npm run lint
38
+ npm run build
39
+ npm pack
40
+ - name : Upload
41
+ uses : actions/upload-artifact@v2
42
+ with :
43
+ name : package
44
+ path : " react-static-web-apps-auth/*.tgz"
45
+ - run : echo "tag=${GITHUB_REF##*/v}" >> $GITHUB_ENV
46
+ - name : Upload package to release
47
+ uses : actions/upload-release-asset@v1
48
+ env :
49
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
50
+ with :
51
+ upload_url : ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
52
+ asset_path : ' react-static-web-apps-auth/aaronpowell-react-static-web-apps-auth-${{ env.tag }}.tgz'
53
+ asset_name : ' aaronpowell-react-static-web-apps-auth-${{ env.tag }}.tgz'
54
+ asset_content_type : application/zip
55
+ - run : echo ${{ steps.create_release.outputs.id }} >> release.txt
56
+ - name : Upload
57
+ uses : actions/upload-artifact@v2
58
+ with :
59
+ name : release_id
60
+ path : react-static-web-apps-auth/release.txt
35
61
36
- publish-npm :
62
+ release :
37
63
needs : build
38
64
runs-on : ubuntu-latest
39
- defaults :
40
- run :
41
- working-directory : react-static-web-apps-auth
65
+ environment :
66
+ name : release
67
+ steps :
68
+ - name : Download package
69
+ uses : actions/download-artifact@v2
70
+ with :
71
+ name : release_id
72
+ - run : echo "release_id=$(cat release.txt)" >> $GITHUB_ENV
73
+ - name : Publish release
74
+ uses : actions/github-script@v3
75
+ with :
76
+ github-token : ${{secrets.GITHUB_TOKEN}}
77
+ script : |
78
+ github.repos.updateRelease({
79
+ owner: context.repo.owner,
80
+ repo: context.repo.repo,
81
+ release_id: process.env.release_id,
82
+ draft: false
83
+ })
84
+ publish-npm :
85
+ needs : release
86
+ runs-on : ubuntu-latest
42
87
steps :
43
88
- uses : actions/checkout@v2
89
+ - name : Download package
90
+ uses : actions/download-artifact@v2
91
+ with :
92
+ name : package
44
93
- uses : actions/setup-node@v1
45
94
with :
46
95
node-version : ${{ env.NODE_VERSION }}
47
96
registry-url : https://registry.npmjs.org/
48
- - run : npm ci
49
- - run : npm run build
50
- - run : npm publish --access public
97
+ - run : npm publish $(ls *.tgz) --access public
51
98
env :
52
99
NODE_AUTH_TOKEN : ${{secrets.npm_token}}
53
100
54
101
publish-gpr :
55
- needs : build
102
+ needs : release
56
103
runs-on : ubuntu-latest
57
- defaults :
58
- run :
59
- working-directory : react-static-web-apps-auth
60
104
steps :
61
105
- uses : actions/checkout@v2
106
+ - name : Download package
107
+ uses : actions/download-artifact@v2
108
+ with :
109
+ name : package
62
110
- uses : actions/setup-node@v1
63
111
with :
64
112
node-version : ${{ env.NODE_VERSION }}
65
113
registry-url : https://npm.pkg.github.com/
66
114
scope : " @aaronpowell"
67
- - run : npm ci
68
115
- run : echo "registry=https://npm.pkg.github.com/@aaronpowell" >> .npmrc
69
- - run : npm run build
70
- - run : npm publish --access public
116
+ - run : npm publish $(ls *.tgz) --access public
71
117
env :
72
118
NODE_AUTH_TOKEN : ${{secrets.GITHUB_TOKEN}}
0 commit comments