|
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 |
5 | 2 |
|
6 | 3 | on: |
7 | 4 | push: |
8 | 5 | tags: |
9 | 6 | - 'v*' |
10 | | - |
| 7 | + |
11 | 8 | jobs: |
12 | 9 | 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 |
22 | 11 | 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 |
33 | 19 |
|
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 }} |
41 | 27 |
|
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 }} |
49 | 44 |
|
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 }} |
55 | 49 |
|
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 |
61 | 51 | id: generate_changelog |
62 | 52 | run: | |
63 | 53 | changelog=$(npm run changelog:last --silent) |
64 | 54 | changelog="${changelog//$'\n'/'%0A'}" |
65 | 55 | changelog="${changelog//$'\r'/'%0D'}" |
66 | 56 | echo -e "set-output name=changelog::${changelog-<empty>}\n" |
67 | 57 | 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 |
68 | 69 |
|
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 |
84 | 73 |
|
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