-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (126 loc) · 4.75 KB
/
Copy pathnode-stable-release.yaml
File metadata and controls
133 lines (126 loc) · 4.75 KB
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Stable release
on:
push:
branches:
- 'main'
paths-ignore:
- '**/*.md'
- 'docs/**'
- '*.md'
- 'LICENSE'
- 'package.json'
jobs:
stable-release:
name: Create stable release
env:
CI: true
GPG_KEY: ${{ secrets.SPQR_BOT_GPG_KEY }}
GPG_KEY_ID: ${{ secrets.SPQR_BOT_GPG_KEY_ID }}
NPM_READ_TOKEN: ${{ secrets.NPM_AUTOMATION_TOKEN || secrets.NPM_READ_AND_PUBLISH_TOKEN || secrets.NPM_READ_TOKEN }}
NPM_READ_AND_PUBLISH_TOKEN: ${{ secrets.NPM_AUTOMATION_TOKEN || secrets.NPM_READ_AND_PUBLISH_TOKEN }}
STABLE_RELEASE_BRANCH: 'main'
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v2
with:
token: ${{ secrets.SPQR_GITHUB_PERSONAL_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
- name: Fetch
run: |
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
git fetch --unshallow origin $STABLE_RELEASE_BRANCH
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_READ_TOKEN" > .npmrc
yarn install --frozen-lockfile --production=false
yarn add @skypilot/quick-release sort-package-json conventional-changelog-cli@2 --production=false
git checkout -- .
- name: Lint config files
run: yarn sort-package-json
- name: Check types
if: success()
run: |
if [[ $(yarn --silent spqr-option 'release.check-code') == 'true' ]] ; then
yarn run typecheck
fi
- name: Lint
if: success()
run: |
if [[ $(yarn --silent spqr-option 'release.check-code') == 'true' ]] ; then
yarn run lint --no-cache --quiet
fi
- name: Test
if: success()
run: |
if [[ $(yarn --silent spqr-option 'release.check-code') == 'true' ]] ; then
yarn test
fi
- name: Gather published versions
run: |
mkdir -p local
yarn info --silent . versions > local/published-versions.txt
- name: Bump version
if: success()
run: |
yarn --silent bump-version && yarn --silent conventional-changelog -p angular -r 0 > CHANGELOG.md
echo "VERSION=$(yarn --silent get-current-version)" >> $GITHUB_ENV
echo "VERSION_TAG=v$(yarn --silent get-current-version)" >> $GITHUB_ENV
echo "VERSION_STAGE=$(git symbolic-ref --short HEAD)" >> $GITHUB_ENV
- name: Build
if: success()
run: |
if [[ $(yarn --silent spqr-option 'release.build') == 'true' ]] ; then
yarn run build
fi
- name: Publish
if: success()
run: |
if [[ $(yarn --silent spqr-option release.publish) == 'true' ]] ; then
if test -z "$NPM_READ_AND_PUBLISH_TOKEN" ; then
echo "No NPM_READ_AND_PUBLISH_TOKEN found. Skipping publication"
else
yarn config set //registry.yarnpkg.com/:_authToken=$NPM_READ_AND_PUBLISH_TOKEN
yarn publish --access $(yarn --silent spqr-option release.access) --non-interactive
fi
else
echo "release.publish = false. Skipping publication."
echo "To publish, set \`release.publish: true\` in .skypilot/quick-release.yaml."
fi
- name: Configure identity
if: success()
run: |
git config --global user.email "$(yarn --silent spqr-option bot.email)"
git config --global user.name "$(yarn --silent spqr-option bot.name)"
if test -n "$GPG_KEY" && test -n "$GPG_KEY_ID"; then
echo "$GPG_KEY" | base64 -d > private.key
gpg --import ./private.key
rm ./private.key
git config --global commit.gpgsign true
git config --global tag.gpgsign true
git config --global user.signingkey $GPG_KEY_ID
else
echo "GPG_KEY and/or GPG_KEY_ID is undefined in GitHub Secrets. The commit & tag will not be signed."
fi
- name: Commit files
if: success()
run: |
git add package.json CHANGELOG.md
git commit --message "Release $VERSION"
- name: Tag
if: success()
run: |
git tag -a $VERSION_TAG -m "Release $VERSION"
- name: Push changes
if: success()
run: git push --tags origin $VERSION_STAGE
- name: Update next branch
if: success()
run: git fetch origin next && git checkout next && git merge --ff-only $STABLE_RELEASE_BRANCH && git push origin next