Skip to content

chore(cicd): Create release workflow following #366 discussion proposal 1 #369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Jan 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions .github/workflows/on-merge-to-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: on-merge-to-main
on:
push:
branches:
- main
workflow_dispatch: {}
jobs:
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

# For merge to main we
## don't create github release,
## don't update changelog (--no-changelog)
## bump version as a pre-release (--conventional-prerelease)
## add a custom preid (--preid dev): 0.2.0-dev.1 -> 0.2.0-dev.2
npx lerna version --conventional-commits --conventional-prerelease --preid dev --force-publish=* --yes --no-changelog
git push --delete origin $(git describe --abbrev=0)
- name: update_release_draft:
uses: release-drafter/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#########################
# Generate documentation
#########################
- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.8'
- 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="dev"
echo "Publishing doc for version: $VERSION"
mkdocs build
mike deploy --push "$VERSION"
- 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: dev/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
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
name: release
on:
push:
branches:
- main
workflow_dispatch: {}
jobs:
publish:
Expand Down Expand Up @@ -44,12 +41,7 @@ jobs:
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

if [ ${{ github.base_ref }} = main ]; then
npx lerna version --conventional-commits --create-release github --force-publish=* --yes
else
npx lerna version --conventional-commits --conventional-prerelease --preid beta --create-release github --force-publish=* --yes
fi
npx lerna version --conventional-commits --conventional-graduate --force-publish=* --yes
npx lerna publish from-git --no-verify-access --yes
#########################
# Generate documentation
Expand Down
14 changes: 0 additions & 14 deletions .github/workflows/release-drafter.yml

This file was deleted.