forked from orkestral/venom
-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (67 loc) · 2.39 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
name: Publish
on:
push:
tags:
- 'v*'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version: '12.x'
registry-url: 'https://registry.npmjs.org'
- name: Get npm cache directory
id: npm-cache
run: echo "::set-output name=dir::$(npm config get cache)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- name: Install Dependencies
run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
PUPPETEER_SKIP_DOWNLOAD: true
- name: Check if version exists
id: check_version
run: |
version=$(echo ${{ github.ref }} | sed -n 's/refs\/tags\/v\(.*\)/\1/p')
npm show venom-bot@$version >/dev/null 2>&1 || echo "::set-output name=version_exists::false"
- name: Publish to npm
if: steps.check_version.outputs.version_exists != 'false'
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Generate Changelog
id: generate_changelog
run: |
changelog=$(npm run changelog:last --silent)
changelog="${changelog//$'\n'/'%0A'}"
changelog="${changelog//$'\r'/'%0D'}"
echo -e "::set-output name=changelog::${changelog}\n"
- name: Extract Version
id: extract_version
run: echo "::set-output name=version::$(echo ${{ github.ref }} | sed -n 's/refs\/tags\/v\(.*\)/\1/p')"
- name: Create Release
uses: actions/create-release@v1
with:
tag_name: v${{ steps.extract_version.outputs.version }}
release_name: v${{ steps.extract_version.outputs.version }}
body: ${{ steps.generate_changelog.outputs.changelog }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build API Docs
run: npm run docs:build
continue-on-error: true
- name: Deploy API Docs
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./api-docs
continue-on-error: true