π Release #85
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 release the packages. | |
name: π Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
type: choice | |
description: Choose which version to bump before release | |
default: 'Auto' | |
options: | |
- Auto | |
- Major | |
- Minor | |
- Patch | |
preRelease: | |
description: | | |
The pre-release identifier for the version. | |
For example, if the version is "1.2.3-beta.1", the pre-release identifier is "beta.1". | |
default: "" | |
type: string | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
env: | |
GH_TOKEN: ${{ secrets.UI_BOT_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
jobs: | |
release: | |
name: π¦ Release | |
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x] | |
pnpm-version: [8.15.7] | |
steps: | |
- name: β¬οΈ Checkout | |
id: checkout | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
token: ${{ env.GH_TOKEN }} | |
- name: π’ Setup node | |
id: setup-node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: π₯‘ Setup pnpm | |
id: setup-pnpm | |
uses: pnpm/[email protected] | |
with: | |
version: ${{ matrix.pnpm-version }} | |
run_install: false | |
- name: π Get pnpm store directory | |
id: get-pnpm-cache-dir | |
run: | | |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)" | |
- name: 𧩠Install Dependencies | |
id: install-dependencies | |
run: pnpm install | |
- name: ποΈ Build | |
id: build | |
run: pnpm build | |
- name: π’ Release & Publish | |
id: release-and-publish | |
run: | | |
git config user.name "wso2-ui-bot" | |
git config user.email "[email protected]" | |
echo "//registry.npmjs.org/:_authToken=${{ env.NPM_TOKEN }}" >> ~/.npmrc | |
if [ "${{ github.event.inputs.version }}" = "Major" ]; then | |
if [ -n "${{ github.event.inputs.preRelease }}" ]; then | |
npm run release -- major --preRelease="${{ github.event.inputs.preRelease }}" --ci | |
else | |
npm run release -- major --ci | |
fi | |
elif [ "${{ github.event.inputs.version }}" = "Minor" ]; then | |
if [ -n "${{ github.event.inputs.preRelease }}" ]; then | |
npm run release -- minor --preRelease="${{ github.event.inputs.preRelease }}" --ci | |
else | |
npm run release -- minor --ci | |
fi | |
elif [ "${{ github.event.inputs.version }}" = "Patch" ]; then | |
if [ -n "${{ github.event.inputs.preRelease }}" ]; then | |
npm run release -- patch --preRelease="${{ github.event.inputs.preRelease }}" --ci | |
else | |
npm run release -- patch --ci | |
fi | |
else | |
if [ -n "${{ github.event.inputs.preRelease }}" ]; then | |
npm run release -- --preRelease="${{ github.event.inputs.preRelease }}" --ci | |
else | |
npm run release -- --ci | |
fi | |
fi | |
env: | |
NPM_TOKEN: ${{ env.NPM_TOKEN }} | |
GITHUB_TOKEN: ${{ env.GH_TOKEN }} |