forked from serverless/serverless
-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (84 loc) · 3.07 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Version tags only
name: Publish
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
jobs:
npmPublish:
name: Publish to npm
runs-on: ubuntu-latest
env:
# It'll work with secrets.GITHUB_TOKEN (which is provided by GitHub unconditionally)
# Still then release author would be "github-actions". It's better if it's dedicated repo bot
GITHUB_TOKEN: ${{ secrets.USER_GITHUB_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Retrieve dependencies from cache
uses: actions/cache@v2
with:
path: |
~/.npm
node_modules
key: npm-v14-${{ runner.os }}-refs/heads/master-${{ hashFiles('package.json') }}
- name: Install Node.js and npm
uses: actions/setup-node@v1
with:
node-version: 14.x
registry-url: https://registry.npmjs.org
# Note: No need to install dependencies as we have retrieved cached `node_modules` for very
# same `package.json` as stored with recent `master `build
- name: Publish new version
# Note: Setting NODE_AUTH_TOKEN as job|workspace wide env var won't work
# as it appears actions/setup-node sets own value
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish
- name: Build standalone artifacts
run: npm run pkg:build
- name: Publish release notes
run: |
TEMP_ARRAY=($(echo $GITHUB_REF | tr "/" "\n"))
TAG=${TEMP_ARRAY[@]: -1}
npx github-release-from-cc-changelog $TAG
- name: Publish standalone artifacts
env:
TENCENT_SECRET_KEY: ${{ secrets.TENCENT_SECRET_KEY }}
TENCENT_SECRET_ID: ${{ secrets.TENCENT_SECRET_ID }}
run: |
TEMP_ARRAY=($(echo $GITHUB_REF | tr "/" "\n"))
TAG=${TEMP_ARRAY[@]: -1}
npm run pkg:upload -- $TAG
chocoPublish:
name: Publish to Chocolatey
needs: npmPublish
runs-on: windows-latest
env:
CHOCO_API_KEY: ${{ secrets.CHOCO_API_KEY }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Retrieve dependencies from cache
uses: actions/cache@v2
with:
path: |
~/.npm
node_modules
key: npm-v14-${{ runner.os }}-refs/heads/master-${{ hashFiles('package.json') }}
- name: Install Node.js and npm
uses: actions/setup-node@v1
with:
node-version: 14.x
registry-url: https://registry.npmjs.org
# Note: No need to install dependencies as we have retrieved cached `node_modules` for very
# same `package.json` as stored with recent `master `build
- name: Publish to Chocolatey
shell: bash
run: |
TEMP_ARRAY=($(echo $GITHUB_REF | tr "/" "\n"))
TAG=${TEMP_ARRAY[@]: -1}
cd `npm run pkg:generate-choco-package $TAG | tail -1`
choco apikey --key $CHOCO_API_KEY --source https://push.chocolatey.org/
choco pack
choco push serverless.${TAG:1}.nupkg