Skip to content

Commit 5b723d0

Browse files
committed
split beta and prod workflow to release two types of package
1 parent b731a21 commit 5b723d0

File tree

2 files changed

+88
-5
lines changed

2 files changed

+88
-5
lines changed

.github/workflows/on-release.yml renamed to .github/workflows/on-release-beta.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,8 @@ jobs:
3939
git config --global user.name 'github-actions[bot]'
4040
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
4141
git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/$GITHUB_REPOSITORY
42+
npx lerna version --conventional-commits --conventional-prerelease --preid beta --create-release github --force-publish=* --yes
4243
43-
if [ ${{ github.base_ref }} = main ]; then
44-
npx lerna version --conventional-commits --create-release github --force-publish=* --yes
45-
else
46-
npx lerna version --conventional-commits --conventional-prerelease --preid beta --create-release github --force-publish=* --yes
47-
fi
4844
npx lerna publish from-git --no-verify-access --yes
4945
#########################
5046
# Generate documentation

.github/workflows/on-release-prod.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: release
2+
on:
3+
workflow_dispatch: {}
4+
jobs:
5+
publish:
6+
runs-on: ubuntu-latest
7+
8+
steps:
9+
- name: "Checkout"
10+
uses: actions/checkout@v2
11+
with:
12+
token: ${{ secrets.GH_PUBLISH_TOKEN }}
13+
fetch-depth: 0
14+
#########################
15+
# Release new version
16+
#########################
17+
- name: "Use NodeJS 14"
18+
uses: actions/setup-node@v2
19+
with:
20+
node-version: '14'
21+
- name: "Setup npm"
22+
run: |
23+
npm set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"
24+
- name: Install packages
25+
run: |
26+
npm ci
27+
npm run lerna-ci
28+
- name: Run lint
29+
run: npm run lerna-lint
30+
- name: Run tests
31+
run: npm run lerna-test
32+
- name: "Version and publish"
33+
env:
34+
GH_TOKEN: ${{ secrets.GH_PUBLISH_TOKEN }}
35+
run: |
36+
git config --global user.name 'github-actions[bot]'
37+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
38+
git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/$GITHUB_REPOSITORY
39+
npx lerna version --conventional-commits --create-release github --force-publish=* --yes
40+
npx lerna publish from-git --no-verify-access --yes
41+
#########################
42+
# Generate documentation
43+
#########################
44+
- name: Set up Python
45+
uses: actions/setup-python@v2.3.1
46+
with:
47+
python-version: '3.8'
48+
- name: Set RELEASE_VERSION env var
49+
run: |
50+
RELEASE_VERSION=$(cat packages/commons/package.json | jq '.version' -r)
51+
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV
52+
- name: Install doc generation dependencies
53+
run: |
54+
pip install --upgrade pip
55+
pip install -r docs/requirements.txt
56+
- name: Setup doc deploy
57+
run: |
58+
git config --global user.name Docs deploy
59+
git config --global user.email docs@dummy.bot.com
60+
- name: Build mkdocs site in "gh-pages" branch and push
61+
run: |
62+
rm -rf site
63+
VERSION="${{ env.RELEASE_VERSION }}"
64+
ALIAS="latest"
65+
echo "Publishing doc for version: $VERSION"
66+
mkdocs build
67+
mike deploy --push --update-aliases "$VERSION" "$ALIAS"
68+
# Set latest version as a default
69+
mike set-default --push latest
70+
- name: Build API docs
71+
run: |
72+
rm -rf api
73+
npm run docs-generateApiDoc
74+
- name: Release API docs to the released version
75+
uses: peaceiris/actions-gh-pages@v3
76+
with:
77+
github_token: ${{ secrets.GITHUB_TOKEN }}
78+
publish_dir: ./api
79+
keep_files: true
80+
destination_dir: ${{ env.RELEASE_VERSION }}/api
81+
- name: Release API docs to the "latest" version
82+
uses: peaceiris/actions-gh-pages@v3
83+
with:
84+
github_token: ${{ secrets.GITHUB_TOKEN }}
85+
publish_dir: ./api
86+
keep_files: true
87+
destination_dir: latest/api

0 commit comments

Comments
 (0)