chore(example): release version 4.3.1 #267
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: Publish Release | |
on: | |
push: | |
branches: [master] | |
jobs: | |
setup: | |
if: "!contains(github.event.head_commit.message, 'skip ci')" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.BOT_TOKEN }} | |
fetch-depth: 0 | |
ref: 'master' | |
- name: Derive appropriate SHAs for base and head for `nx affected` commands | |
uses: nrwl/nx-set-shas@v3 | |
with: | |
main-branch-name: 'master' | |
- name: Set Node Version | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: | | |
echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT | |
- name: Restore yarn cache | |
uses: actions/cache@v3 | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-20-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-20-yarn- | |
- name: Install Dependencies | |
run: yarn install --immutable | |
- name: Check Constraints | |
run: yarn constraints | |
- name: Lint Affected Code | |
run: yarn nx affected --target=lint | |
- name: Unit Test Affected Code | |
run: yarn nx affected --target=test | |
- name: Integration Test Affected Code | |
run: yarn nx affected --target=integration | |
# version-check: | |
# needs: setup | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v3 | |
# with: | |
# token: ${{ secrets.BOT_TOKEN }} | |
# fetch-depth: 0 | |
# ref: 'master' | |
# - uses: actions/setup-node@v3 | |
# with: | |
# node-version: 14 | |
# - name: Get yarn cache directory path | |
# id: yarn-cache-dir-path | |
# run: | | |
# echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT | |
# - uses: actions/cache@v3 | |
# id: yarn-cache | |
# with: | |
# path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
# key: ${{ runner.os }}-14-yarn-${{ hashFiles('**/yarn.lock') }} | |
# restore-keys: | | |
# ${{ runner.os }}-14-yarn- | |
# - run: yarn install --immutable | |
# - run: yarn version check | |
# - run: yarn check:versions | |
release: | |
needs: [setup] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.BOT_TOKEN }} | |
fetch-depth: 0 | |
ref: 'master' | |
- name: Derive appropriate SHAs for base and head for `nx affected` commands | |
uses: nrwl/nx-set-shas@v3 | |
with: | |
main-branch-name: 'master' | |
- name: Set Node Version | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: | | |
echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT | |
- name: Restore yarn cache | |
uses: actions/cache@v3 | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-20-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-20-yarn- | |
- name: Install Dependencies | |
run: yarn install --immutable | |
# TODO: ngx-deploy-npm? Or continue to leverage nx + yarn npm publish command? | |
- name: Release | |
run: | | |
yarn config set npmAuthToken "${{ secrets.NPM_TOKEN }}" | |
git config --global user.email ${{ secrets.GH_EMAIL }} | |
git config --global user.name ${{ secrets.GH_USER }} | |
yarn nx affected --target version --parallel=1 | |
yarn nx affected --target publish --parallel=1 | |
git push && git push --tags | |
# TODO: nx caching | |
- name: Build Docs | |
run: yarn nx build docusaurus | |
- name: Deploy Docs | |
uses: crazy-max/ghaction-github-pages@v3 | |
with: | |
target_branch: gh-pages | |
build_dir: docusaurus/build | |
commit_message: deployed docs [skip ci] | |
committer: ${{ secrets.GH_USER }} ${{ secrets.GH_EMAIL }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} |