-
Notifications
You must be signed in to change notification settings - Fork 1
78 lines (63 loc) · 2.43 KB
/
publish.yml
File metadata and controls
78 lines (63 loc) · 2.43 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
name: "Publish"
on:
pull_request:
branches:
- main
types: [closed]
jobs:
publish_js:
name: "Create release for JS client"
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./js
if: >-
${{ github.event.pull_request.merged == true &&
contains(github.event.pull_request.labels.*.name, 'js') && (
contains(github.event.pull_request.labels.*.name, 'patch') ||
contains(github.event.pull_request.labels.*.name, 'minor') ||
contains(github.event.pull_request.labels.*.name, 'major') ) }}
steps:
- name: Checkout the repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- name: Setup git user
run: |
git config user.name "Abhay V Ashokan"
git config user.email "abhay.ashokan@bigbinary.com"
- name: Setup NodeJS LTS version
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
with:
node-version-file: ".nvmrc"
- name: Setup the project
run: yarn install
- name: Generate production build
run: yarn build
- name: Prefix version tag with "v"
run: yarn config set version-tag-prefix "v"
- name: Disable Git commit hooks
run: git config core.hooksPath /dev/null
- name: Bump the patch version and create git tag on release
if: ${{ contains(github.event.pull_request.labels.*.name, 'patch') }}
run: yarn version --patch
- name: Bump the minor version and create git tag on release
if: ${{ contains(github.event.pull_request.labels.*.name, 'minor') }}
run: yarn version --minor
- name: Bump the major version and create git tag on release
if: ${{ contains(github.event.pull_request.labels.*.name, 'major') }}
run: yarn version --major
- name: Get the package version from package.json
uses: tyankatsu0105/read-package-version-actions@v1
id: package-version
- name: Create a new version release commit
uses: EndBug/add-and-commit@v9
with:
message: "New version release"
- name: Push the commit to main
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main
- name: Publish the package on NPM
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
npm publish