Production release pipeline #27
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
name: Production release pipeline | |
on: | |
workflow_dispatch: | |
inputs: | |
release_as: | |
type: choice | |
description: 'release as' | |
required: false | |
options: | |
- none | |
- major | |
- minor | |
- patch | |
pre-release: | |
type: choice | |
description: 'prerelease' | |
required: false | |
options: | |
- none | |
- alpha | |
- beta | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
env: | |
NPM_FONT_AWESOME_TOKEN: ${{ secrets.NPM_FONT_AWESOME_TOKEN }} | |
steps: | |
- name: git checkout | |
uses: actions/checkout@v3 | |
- name: configure committer | |
run: | | |
git config user.name "bmo-amity-bot" | |
git config user.email "[email protected]" | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
run_install: false | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
run: | | |
echo "pnpm_cache_dir=$(pnpm store path | tr -d '\n')" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install | |
- name: increase version (patch) | |
run: pnpm standard-version --yes | |
if: github.event.inputs.release_as == 'patch' && github.event.inputs.pre-release == 'none' | |
- name: increase version (patch) (pre-release) | |
run: pnpm standard-version --yes --release-as patch --prerelease ${{ github.event.inputs.pre-release }} | |
if: github.event.inputs.release_as == 'patch' && github.event.inputs.pre-release != 'none' | |
- name: increase version (minor) | |
run: pnpm standard-version --yes --release-as minor | |
if: github.event.inputs.release_as == 'minor' && github.event.inputs.pre-release == 'none' | |
- name: increase version (minor) (pre-release) | |
run: pnpm standard-version --yes --prerelease ${{ github.event.inputs.pre-release }} | |
if: github.event.inputs.release_as == 'minor' && github.event.inputs.pre-release != 'none' | |
- name: increase version (major) | |
run: pnpm standard-version --yes --release-as major | |
if: github.event.inputs.release_as == 'major' && github.event.inputs.pre-release == 'none' | |
- name: increase version (major) (pre-release) | |
run: pnpm standard-version --yes --release-as major --prerelease ${{ github.event.inputs.pre-release }} | |
if: github.event.inputs.release_as == 'major' && github.event.inputs.pre-release != 'none' | |
- name: increase version (pre-release) | |
run: pnpm standard-version --prerelease ${{ github.event.inputs.pre-release }} | |
if: github.event.inputs.release_as == 'none' && github.event.inputs.pre-release != 'none' | |
- name: build | |
run: pnpm run build | |
- name: publish on npm | |
uses: JS-DevTools/npm-publish@v1 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
access: public | |
- name: push version | |
run: git push --follow-tags |