-
Notifications
You must be signed in to change notification settings - Fork 154
96 lines (96 loc) · 3.42 KB
/
on-release-prod.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
name: release
on:
workflow_dispatch: {}
jobs:
publish:
#########################
# Force Github action to run only a single job at a time (based on the group name)
# This is to prevent "race-condition" in publishing a new version of doc to `gh-pages` (#365)
#########################
concurrency:
group: on-release-publish
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v2
with:
token: ${{ secrets.GH_PUBLISH_TOKEN }}
fetch-depth: 0
#########################
# Release new version
#########################
- name: "Use NodeJS 14"
uses: actions/setup-node@v2
with:
node-version: '14'
- name: "Setup npm"
run: |
npm set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"
- name: Install packages
run: |
npm ci
npm run lerna-ci
- name: Run lint
run: npm run lerna-lint
- name: Run tests
run: npm run lerna-test
- name: "Version and publish"
env:
GH_TOKEN: ${{ secrets.GH_PUBLISH_TOKEN }}
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/$GITHUB_REPOSITORY
npx lerna version --conventional-commits --conventional-graduate --force-publish=* --yes
npx lerna publish from-git --no-verify-access --yes
#########################
# Generate documentation
#########################
- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.8'
- name: Set RELEASE_VERSION env var
run: |
RELEASE_VERSION=$(cat packages/commons/package.json | jq '.version' -r)
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV
- name: Install doc generation dependencies
run: |
pip install --upgrade pip
pip install -r docs/requirements.txt
- name: Setup doc deploy
run: |
git config --global user.name Docs deploy
git config --global user.email [email protected]
- name: Build mkdocs site in "gh-pages" branch and push
run: |
rm -rf site
VERSION="${{ env.RELEASE_VERSION }}"
ALIAS="latest"
echo "Publishing doc for version: $VERSION"
mkdocs build
mike deploy --push --update-aliases --no-redirect "$VERSION" "$ALIAS"
# Once we have agreed on release process, we will also use "main"
# to track the development version (on main branch).
# For now, we make it the same as the latest version.
mike deploy --push --update-aliases --no-redirect "main" "$ALIAS"
# Set latest version as a default
mike set-default --push latest
- name: Build API docs
run: |
rm -rf api
npm run docs-generateApiDoc
- name: Release API docs to the released version
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./api
keep_files: true
destination_dir: ${{ env.RELEASE_VERSION }}/api
- name: Release API docs to the "latest" version
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./api
keep_files: true
destination_dir: latest/api