Skip to content

Commit 937ae22

Browse files
committed
build: add release and publish scripts to gh action
Signed-off-by: Vitor Hugo Salgado <[email protected]>
1 parent 6c1ab43 commit 937ae22

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.github/workflows/ci.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,55 @@ jobs:
6262
yarn coverage:upload
6363
env:
6464
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
65+
66+
release:
67+
runs-on: ubuntu-latest
68+
if: startsWith(github.ref, 'refs/tags/v')
69+
needs:
70+
- build
71+
72+
steps:
73+
- name: Checkout
74+
uses: actions/checkout@v2
75+
76+
- name: Use Node
77+
id: setup-node
78+
uses: actions/setup-node@v2
79+
env:
80+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
81+
with:
82+
node-version: 14.x
83+
registry-url: 'https://registry.npmjs.org'
84+
85+
- name: Get Yarn Cache
86+
id: yarn-cache
87+
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
88+
89+
- name: Yarn Cache
90+
uses: actions/cache@v2
91+
with:
92+
path: ${{ steps.yarn-cache.outputs.dir }}
93+
key: yarn2-${{ hashFiles('yarn.lock') }}
94+
restore-keys: |
95+
yarn2-
96+
97+
- name: Deps
98+
run: |
99+
yarn --immutable
100+
101+
- name: Publish
102+
env:
103+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
104+
run: |
105+
npm publish --access public
106+
107+
- name: Release
108+
uses: actions/create-release@v1
109+
env:
110+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
111+
with:
112+
tag_name: ${{ github.ref }}
113+
release_name: Release ${{ github.ref }}
114+
body_path: CHANGELOG.md
115+
draft: false
116+
prerelease: contains(github.ref, '-')

0 commit comments

Comments
 (0)