-
-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (90 loc) · 3.39 KB
/
release.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
100
101
102
103
104
105
106
107
108
109
name: Publish package
on:
create:
jobs:
release:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '14.x'
- name: Set release version env variables
run: |
export RELEASE_TAG_VERSION="$(echo "${{ github.ref }}" | grep -oP '(?<=refs/tags/v)\d+\.\d+\.\d+.*')"
echo "RELEASE_TAG_VERSION=${RELEASE_TAG_VERSION}" >> $GITHUB_ENV
export MAJOR_TAG_VERSION="$(echo ${RELEASE_TAG_VERSION} | grep -oP '^[^.]+').x"
echo "MAJOR_TAG_VERSION=${MAJOR_TAG_VERSION}" >> $GITHUB_ENV
- name: Ensure new version is mentioned in change log
run: grep --regexp "\[v${RELEASE_TAG_VERSION}\]" CHANGELOG.md
- name: Extract changelog for release
run: awk -v ver=${RELEASE_TAG_VERSION} '/^#+ \[v/ { if (p) { exit }; if ($2 ~ "[v"ver"]") { p=1; next } } p' CHANGELOG.md > release-changelog.md
- name: Install dependencies
run: yarn install --immutable
- name: Lint
run: yarn lint
- name: Run tests
run: yarn test --maxWorkers=2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install docs dependencies
run: yarn install-docs-deps
- name: Clean docs directories
run: rm -rf site docs/api
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v4
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASS }}
git_user_signingkey: true
git_commit_gpgsign: true
git_tag_gpgsign: true
- name: Set aliases
run: |
export LATEST_DOCS_VERSION="$(mike list | grep -oP '^.+(?= \[latest\])')"
if [ -z "$LATEST_DOCS_VERSION" ]; then
echo "ALIAS_LATEST=latest" >> $GITHUB_ENV
else
npx -y semver -r ">$LATEST_DOCS_VERSION" ${RELEASE_TAG_VERSION}
if [ $? -eq 0 ]; then
echo "ALIAS_LATEST=latest" >> $GITHUB_ENV
fi
fi
export LATEST_DOCS_VERSION_FOR_MAJOR="$(mike list | grep -oP "^.+(?= \[$MAJOR_TAG_VERSION\])")"
if [ -z "$LATEST_DOCS_VERSION_FOR_MAJOR" ]; then
echo "ALIAS_MAJOR=$MAJOR_TAG_VERSION" >> $GITHUB_ENV
else
npx -y semver -r "^$LATEST_DOCS_VERSION_FOR_MAJOR" ${RELEASE_TAG_VERSION}
if [ $? -eq 0 ]; then
echo "ALIAS_MAJOR=$MAJOR_TAG_VERSION" >> $GITHUB_ENV
fi
fi
- name: Build docs
run: |
yarn build-docs:api
mike deploy -u ${RELEASE_TAG_VERSION} ${ALIAS_MAJOR} ${ALIAS_LATEST}
mike set-default --push latest
env:
VERSION: ${{ env.RELEASE_TAG_VERSION }}
ALIAS: latest
- name: Build package
run: yarn pack
- name: Create release
uses: softprops/action-gh-release@v1
with:
body_path: release-changelog.md
files: package.tgz
- name: Deploy docs
run: git push origin gh-pages
- name: Publish to registry
run: |
yarn config set npmAlwaysAuth true
yarn config set npmAuthToken ${{ secrets.NPM_TOKEN }}
yarn npm publish