-
Notifications
You must be signed in to change notification settings - Fork 0
128 lines (126 loc) · 4.64 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
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
---
name: publish
on:
push:
tags:
- v*
jobs:
npm:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
registry-url: https://registry.npmjs.org
- name: Check version
id: version
run: |
echo "::set-output name=name::$(jq -r '.name' package.json)"
echo "::set-output name=current::$(jq -r '.version' package.json)"
echo "::set-output name=published::$(npm view $(jq -r '.name' package.json)@$(jq -r '.version' package.json) version)"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish ${{ steps.version.outputs.name }}@${{ steps.version.outputs.current }}
if: ${{ endsWith(github.ref, format('v{0}', steps.version.outputs.published)) == false }}
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
github:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
registry-url: https://npm.pkg.github.com
- name: Check version
id: version
run: |
echo "::set-output name=name::$(jq -r '.name' package.json)"
echo "::set-output name=current::$(jq -r '.version' package.json)"
echo "::set-output name=published::$(npm view $(jq -r '.name' package.json)@$(jq -r '.version' package.json) version)"
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish ${{ steps.version.outputs.name }}@${{ steps.version.outputs.current }}
if: ${{ endsWith(github.ref, format('v{0}', steps.version.outputs.published)) == false }}
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ github.repository_owner }}
SENTRY_PROJECT: ${{ github.event.repository.name }}
with:
version: ${{ steps.version.outputs.current }}
version_prefix: ${{ github.event.repository.name }}@
docs:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.GH_TOKEN }}
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v3
id: import_gpg
with:
git-user-signingkey: true
git-commit-gpgsign: true
git-committer-name: ${{ secrets.GIT_USER_NAME }}
git-committer-email: ${{ secrets.GIT_USER_EMAIL }}
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Get yarn cache directory
id: yarn-cache-dir
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Yarn cache
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Node modules cache
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: yarn install --frozen-lockfile --non-interactive
- name: Get version
id: version
run: |
echo "::set-output name=current::$(jq -r '.version' package.json)"
- name: Documentation
run: yarn run docs:build
- name: Publish ${{ steps.version.outputs.current }}
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.GH_TOKEN }}
publish_dir: .docs
destination_dir: ${{ steps.version.outputs.current }}
keep_files: true
user_name: ${{ secrets.GIT_USER_NAME }}
user_email: ${{ secrets.GIT_USER_EMAIL }}
- name: Publish latest
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.GH_TOKEN }}
publish_dir: .docs
keep_files: true
user_name: ${{ secrets.GIT_USER_NAME }}
user_email: ${{ secrets.GIT_USER_EMAIL }}