forked from ecyrbe/zodios-react
-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (64 loc) · 1.94 KB
/
publish.yml
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
# publish on npm when there is a new version tag
name: publish
on:
push:
tags: [v*]
jobs:
publish:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
registry-url: "https://registry.npmjs.org"
node-version: ${{ matrix.node-version }}
cache: "yarn"
- name: install dependencies
run: yarn install
- name: build
run: yarn build
- name: run test
run: yarn test
- name: publish to npm
# only run when tag has no 'rc' in it
if: ${{ !contains(github.ref, 'rc') }}
run: yarn publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: publish beta to npm
# only run when tag has 'rc' in it
if: ${{ contains(github.ref, 'rc') }}
run: yarn publish --access public --tag beta
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: generate changelog
uses: orhun/git-cliff-action@v2
id: cliff
with:
args: --latest --strip footer
env:
OUTPUT: CHANGES.md
- name: save changelog
id: changelog
shell: bash
run: |
changelog=$(cat ${{ steps.cliff.outputs.changelog }})
changelog="${changelog//'%'/'%25'}"
changelog="${changelog//$'\n'/'%0A'}"
changelog="${changelog//$'\r'/'%0D'}"
echo "changelog=$changelog" >> $GITHUB_OUTPUT
- name: create release
id: release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: ${{ steps.changelog.outputs.changelog }}
draft: false
prerelease: false