Release stable #22
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: Release stable | |
on: | |
workflow_dispatch: | |
inputs: | |
release_type: | |
description: Release type | |
required: true | |
type: choice | |
options: | |
- patch | |
- minor | |
- major | |
default: patch | |
skip_release: | |
description: Skip release | |
required: true | |
type: boolean | |
default: false | |
upload_to_chrome_web_store: | |
description: Upload to Chrome Web Store | |
required: true | |
type: boolean | |
default: false | |
jobs: | |
build_and_release: | |
runs-on: ubuntu-latest | |
env: | |
EXTENSION_ID: ${{ vars.EXTENSION_ID }} | |
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }} | |
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }} | |
GOOGLE_REFRESH_TOKEN: ${{ secrets.GOOGLE_REFRESH_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: pnpm/action-setup@v2 | |
with: | |
run_install: false | |
- uses: actions/setup-node@v3 | |
with: | |
cache: pnpm | |
node-version-file: .nvmrc | |
registry-url: https://registry.npmjs.org | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- run: | | |
git config --global user.name "${{ github.actor }}" | |
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | |
- name: Install dependencies | |
run: | | |
pnpm install | |
pnpm install -g chrome-webstore-upload-cli | |
- name: Build and package | |
id: build_and_package | |
run: pnpm run release ${{ github.event.inputs.release_type }} --ci $SKIP_RELEASE_ARGS | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SKIP_RELEASE_ARGS: ${{ github.event.inputs.skip_release == 'true' && '--no-git --no-github --no-npm' || '' }} | |
- name: Upload to Chrome Web Store | |
if: ${{ steps.build_and_package.outcome == 'success' && github.event.inputs.upload_to_chrome_web_store == 'true' }} | |
run: | | |
chrome-webstore-upload upload \ | |
--source chrome-extension.zip \ | |
--extension-id ${{ env.EXTENSION_ID }} \ | |
--client-id ${{ secrets.GOOGLE_CLIENT_ID }} \ | |
--client-secret ${{ secrets.GOOGLE_CLIENT_SECRET }} \ | |
--refresh-token ${{ secrets.GOOGLE_REFRESH_TOKEN }} |