This repository has been archived by the owner on Dec 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
91 lines (74 loc) · 2.49 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Release Package
on:
release:
types: [released]
jobs:
publish-to-npm:
runs-on: ubuntu-20.04
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: "16.14.0"
registry-url: "https://registry.npmjs.org"
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install 💾
run: npm ci
- name: Get package.json version 👀
id: package-version
uses: martinbeentjes/npm-get-version-action@master
- name: Remove v from release version
id: get_release_version
uses: battila7/get-version-action@v2
- name: Check package.json version matches release tag ✅
run: echo "Package.json version ( ${{ steps.package-version.outputs.current-version}} ) does not match release version ( ${{ steps.get_release_version.outputs.version-without-v }} )" && exit 1
if: steps.package-version.outputs.current-version != steps.get_release_version.outputs.version-without-v
- name: Build 🏗️
run: npm run build
- name: Publish 🚂
run: npm publish --tag latest
env:
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}
working-directory: ./dist
- name: Revert Release if failure 💣
if: ${{ failure() }}
uses: author/action-rollback@stable
with:
tag: ${{ github.event.release.tag_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-and-deploy:
runs-on: ubuntu-20.04
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: "14.15.5"
- name: Update npm to v7
run: npm i -g npm
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install 💾
run: npm ci
- name: Build HTML Docs 🔨
run: npm run doc:html
- name: Build JSON Docs 🔨
run: npm run doc:json
- name: Deploy 🚀
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: dist/docs