Debian Codegraph @

uni-global/.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-v14-${{ 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: 14.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 # Normally we have a guarantee that deps are already there, still it may not be the case when:
44 # - `main` build for same commit failed (and we still pushed tag manually)
45 # - We've pushed tag manually before `master` build finalized
46 - name: Install dependencies
47 if: steps.cacheNpm.outputs.cache-hit != 'true'
48 run: |
49 npm update --no-save
50 npm update --save-dev --no-save
51
52 - name: Publish release notes
53 run: |
54 TEMP_ARRAY=($(echo $GITHUB_REF | tr "/" "\n"))
55 TAG=${TEMP_ARRAY[@]: -1}
56 npx github-release-from-cc-changelog $TAG