Create new release #16
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: Create new release # Right now there's only support for GitHub Releases, but will add support to publish to Chrome Web Store and Firefox and Edge later. | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version of the release (e.g., v1.2.3)' | |
required: true | |
default: 'v1.0.0' | |
push: | |
tags: | |
- "v*.*.*" | |
branches: | |
- $default-branch | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
strategy: | |
matrix: | |
node-version: [18.x, 20.x, 22.x] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
cache-dependency-path: pnpm-lock.yaml | |
- name: Install PNPM and install dependencies | |
run: | | |
npm install -g pnpm | |
pnpm install | |
- name: Zip the extension files | |
run: | | |
pnpm zip | |
pnpm zip:firefox | |
- name: Determine tag name | |
id: set_tag_name | |
run: | | |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
echo "tag_name=${{ github.event.inputs.version }}" >> $GITHUB_ENV | |
echo "::set-output name=tag_name::${{ github.event.inputs.version }}" | |
else | |
echo "tag_name=${{ github.ref_name }}" >> $GITHUB_ENV | |
echo "::set-output name=tag_name::${{ github.ref_name }}" | |
fi | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
body_path: CHANGELOG.md | |
files: | | |
.output/*.zip | |
tag_name: ${{ steps.set_tag_name.outputs.tag_name }} |