Skip to content

Commit a76d696

Browse files
authored
Update publish.yml
1 parent c068d48 commit a76d696

1 file changed

Lines changed: 58 additions & 69 deletions

File tree

.github/workflows/publish.yml

Lines changed: 58 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,79 @@
1-
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3-
4-
name: Node.js CI
1+
name: Publish
52

63
on:
74
push:
85
tags:
96
- 'v*'
10-
7+
118
jobs:
129
publish:
13-
14-
runs-on: ${{ matrix.os }}
15-
16-
strategy:
17-
matrix:
18-
node-version: [12.x]
19-
os: [ubuntu-latest, windows-latest]
20-
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
21-
10+
runs-on: ubuntu-latest
2211
steps:
23-
- uses: actions/checkout@v3
24-
- name: Use Node.js ${{ matrix.node-version }}
25-
uses: actions/setup-node@v3
26-
with:
27-
node-version: ${{ matrix.node-version }}
28-
cache: 'npm'
29-
fetch-depth: 0
30-
31-
- name: Fetching tags
32-
run: git fetch --tags -f || true
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Fetching tags
18+
run: git fetch --tags -f || true
3319

34-
- name: Setup Node
35-
uses: actions/setup-node@v3.2.0
36-
with:
37-
node-version: 12.x
38-
registry-url: 'https://registry.npmjs.org'
39-
env:
40-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
20+
- name: Setup Node
21+
uses: actions/setup-node@v3.2.0
22+
with:
23+
node-version: 12.x
24+
registry-url: 'https://registry.npmjs.org'
25+
env:
26+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4127

42-
- name: Setup npm cache
43-
uses: actions/cache@v3
44-
with:
45-
path: ${{ steps.npm-cache.outputs.dir }}
46-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
47-
restore-keys: |
48-
${{ runner.os }}-node-
28+
- name: Get npm cache directory
29+
id: npm-cache
30+
run: |
31+
echo "::set-output name=dir::$(npm config get cache)"
32+
- name: Setup npm cache
33+
uses: actions/cache@v3
34+
with:
35+
path: ${{ steps.npm-cache.outputs.dir }}
36+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
37+
restore-keys: |
38+
${{ runner.os }}-node-
39+
- name: Install Dependencies
40+
run: npm ci || npm install
41+
env:
42+
PUPPETEER_SKIP_DOWNLOAD: true
43+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4944

50-
- name: Install Dependencies
51-
run: npm ci || npm install
52-
env:
53-
PUPPETEER_SKIP_DOWNLOAD: true
54-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
45+
- name: Publish in NPM
46+
run: npm publish
47+
env:
48+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
5549

56-
- name: Publish in NPM
57-
run: npm run build
58-
env:
59-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
60-
- name: Generate Changelog
50+
- name: Generate Changelog
6151
id: generate_changelog
6252
run: |
6353
changelog=$(npm run changelog:last --silent)
6454
changelog="${changelog//$'\n'/'%0A'}"
6555
changelog="${changelog//$'\r'/'%0D'}"
6656
echo -e "set-output name=changelog::${changelog-<empty>}\n"
6757
echo -e "::set-output name=changelog::${changelog}\n"
58+
- name: Create Release
59+
id: create_release
60+
uses: actions/create-release@v1
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
with:
64+
tag_name: ${{ github.ref }}
65+
release_name: ${{ github.ref }}
66+
body: ${{ steps.generate_changelog.outputs.changelog }}
67+
draft: false
68+
prerelease: false
6869

69-
- name: Create Release
70-
id: create_release
71-
uses: actions/create-release@v1
72-
env:
73-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74-
with:
75-
tag_name: ${{ github.ref }}
76-
release_name: ${{ github.ref }}
77-
body: ${{ steps.generate_changelog.outputs.changelog }}
78-
draft: false
79-
prerelease: false
80-
81-
- name: Build API-Docs
82-
run: npm run docs:build
83-
continue-on-error: true
70+
- name: Build API-Docs
71+
run: npm run docs:build
72+
continue-on-error: true
8473

85-
- name: Deploy API-Docs
86-
uses: peaceiris/actions-gh-pages@v3
87-
continue-on-error: true
88-
with:
89-
github_token: ${{ secrets.GITHUB_TOKEN }}
90-
publish_dir: ./api-docs
74+
- name: Deploy API-Docs
75+
uses: peaceiris/actions-gh-pages@v3
76+
continue-on-error: true
77+
with:
78+
github_token: ${{ secrets.GITHUB_TOKEN }}
79+
publish_dir: ./api-docs

0 commit comments

Comments
 (0)