-
Notifications
You must be signed in to change notification settings - Fork 5
70 lines (61 loc) · 2.06 KB
/
release.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
67
68
69
70
name: Publish to NPM
on:
push:
branches:
- main
jobs:
publish:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: main
- name: "Automated version bump"
uses: "phips28/gh-action-bump-version@master"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
default: patch
commit-message: "Version bump to {{version}} [skip ci]"
tag-prefix: "v"
- name: Export package version
id: package
run: |
echo "package_version=`cat package.json | jq -r .version`" >> $GITHUB_ENV
shell: bash
- run: echo ${{ env.package_version }}
- name: Find and Replace
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "[3-9]+\\.[0-9]+\\.[0-9]+"
replace: ${{ env.package_version }}
regex: true
include: "README.md"
- name: "Version bump in README.md to {{version}} [skip ci]"
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Version bump in README.md to ${{ env.package_version }} [skip ci]"
file_pattern: README.md
- uses: JS-DevTools/npm-publish@v1
id: publish
with:
token: ${{ secrets.NPM_TOKEN }}
check-version: true
dry-run: false
access: "public"
- if: steps.publish.outputs.type != 'none'
run: |
echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}"
- name: Create new release
if: steps.publish.outputs.type != 'none'
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: "v${{ steps.publish.outputs.version }}"
release_name: "v${{ steps.publish.outputs.version }}"
draft: false
prerelease: false