Skip to content

Commit 0bd29ff

Browse files
authored
upgraded release pipeline with approvals
1 parent 84d4f42 commit 0bd29ff

File tree

3 files changed

+71
-19
lines changed

3 files changed

+71
-19
lines changed

.github/workflows/npm-release.yml

Lines changed: 64 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ jobs:
1414
defaults:
1515
run:
1616
working-directory: react-static-web-apps-auth
17+
environment:
18+
name: build
19+
url: ${{ steps.create_release.outputs.html_url }}
1720
steps:
1821
- uses: actions/checkout@v2
1922
- name: Create Release
@@ -24,49 +27,92 @@ jobs:
2427
with:
2528
tag_name: ${{ github.ref }}
2629
release_name: Release ${{ github.ref }}
27-
draft: false
30+
draft: true
2831
prerelease: false
2932
- uses: actions/setup-node@v1
3033
with:
3134
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
3561

36-
publish-npm:
62+
release:
3763
needs: build
3864
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
4287
steps:
4388
- uses: actions/checkout@v2
89+
- name: Download package
90+
uses: actions/download-artifact@v2
91+
with:
92+
name: package
4493
- uses: actions/setup-node@v1
4594
with:
4695
node-version: ${{ env.NODE_VERSION }}
4796
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
5198
env:
5299
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
53100

54101
publish-gpr:
55-
needs: build
102+
needs: release
56103
runs-on: ubuntu-latest
57-
defaults:
58-
run:
59-
working-directory: react-static-web-apps-auth
60104
steps:
61105
- uses: actions/checkout@v2
106+
- name: Download package
107+
uses: actions/download-artifact@v2
108+
with:
109+
name: package
62110
- uses: actions/setup-node@v1
63111
with:
64112
node-version: ${{ env.NODE_VERSION }}
65113
registry-url: https://npm.pkg.github.com/
66114
scope: "@aaronpowell"
67-
- run: npm ci
68115
- 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
71117
env:
72118
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog for `react-static-web-apps-auth`
22

3+
## [0.1.4] - 2021-01-11
4+
5+
### Changed
6+
7+
- More work on build/release pipeline
8+
39
## [0.1.3] - 2021-01-04
410

511
### Fixed

react-static-web-apps-auth/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@aaronpowell/react-static-web-apps-auth",
3-
"version": "0.1.3",
3+
"version": "0.1.4",
44
"description": "A library to help creating authenticated React apps on Azure Static Web Apps",
55
"main": "build/index.js",
66
"types": "build/index.d.ts",

0 commit comments

Comments
 (0)