-
Notifications
You must be signed in to change notification settings - Fork 4
97 lines (94 loc) · 2.82 KB
/
release-stable.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
on:
workflow_run:
workflows:
- build
types:
- completed
branches:
- master
name: Create Release
jobs:
release:
name: Release stable
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 50
ref: refs/heads/master
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- run: git fetch --prune --unshallow
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 14
- name: Install dependencies
run: npm ci
- name: Get latest changelog
id: Changelog
run: |
changelog=$(npm run --silent get-changelog -- --skipUnstable | tail -n +1)
echo $changelog
changelog="${changelog//'%'/'%25'}"
changelog="${changelog//$'\n'/'%0A'}"
changelog="${changelog//$'\r'/'%0D'}"
echo "::set-output name=changelog::$changelog"
- name: Get release version
id: release_type
run: |
RELEASE_VERSION=`cat VERSION`
echo "::set-output name=version::$RELEASE_VERSION"
- name: Create github release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.release_type.outputs.version }}
release_name: Release ${{ steps.release_type.outputs.version }}
body: |
${{ steps.Changelog.outputs.changelog }}
draft: false
prerelease: false
publish-npm:
name: Publish to npm
runs-on: ubuntu-latest
needs: release
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14
registry-url: https://registry.npmjs.org/
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build --if-present
- name: Publish files
run: npm publish --dry-run
- name: Publish
run: npm publish --tag latest
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
# publish-gh:
# name: Publish to github packages
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v1
# with:
# node-version: 14
# registry-url: https://npm.pkg.github.com/
# - name: Install dependencies
# run: npm ci
# - name: Build
# run: npm run build --if-present
# - name: Get npm tag
# id: npm_tag
# run: |
# NPM_TAG=$([[ ${{ github.ref }} == *"-rc"* ]] && echo "next" || echo "latest")
# echo "::set-output name=tag::$NPM_TAG"
# - run: npm publish --access public
# env:
# NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}