Debian Codegraph @

essentials/.github/workflows/publish.yml

raw
1 # Version tags only
2
3 name: Publish
4
5 on:
6 push:
7 tags:
8 - v[0-9]+.[0-9]+.[0-9]+
9
10 jobs:
11 publish:
12 name: Publish
13 runs-on: ubuntu-latest
14 env:
15 # It'll work with secrets.GITHUB_TOKEN (which is provided by GitHub unconditionally)
16 # Still then release author would be "github-actions"
17 GITHUB_TOKEN: ${{ secrets.USER_GITHUB_TOKEN }}
18 steps:
19 - name: Checkout repository
20 uses: actions/checkout@v2
21
22 - name: Retrieve dependencies from cache
23 uses: actions/cache@v2
24 with:
25 path: |
26 ~/.npm
27 node_modules
28 key: npm-v16-${{ runner.os }}-refs/heads/main-${{ hashFiles('package.json') }}
29
30 - name: Install Node.js and npm
31 uses: actions/setup-node@v1
32 with:
33 node-version: 16.x
34 registry-url: https://registry.npmjs.org
35
36 - name: Publish new version
37 # Note: Setting NODE_AUTH_TOKEN as job|workspace wide env var won't work
38 # as it appears actions/setup-node sets own value
39 env:
40 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
41 run: npm publish
42
43 - name: Install dependencies
44 if: steps.cacheNpm.outputs.cache-hit != 'true'
45 run: |
46 npm update --no-save
47 npm update --save-dev --no-save
48
49 - name: Publish release notes
50 run: |
51 TEMP_ARRAY=($(echo $GITHUB_REF | tr "/" "\n"))
52 TAG=${TEMP_ARRAY[@]: -1}
53 npx github-release-from-cc-changelog $TAG