Skip to content

Build Release Package #2

Build Release Package

Build Release Package #2

name: Build Release Package
on:
release:
types: [published, prereleased]
workflow_dispatch:
inputs:
tag:
description: Existing release tag to attach assets to
required: true
permissions:
contents: write
jobs:
build-and-upload:
name: Build and Upload Chrome Package
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 9
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Prepare build output
run: |
rm -rf build package
- name: Build extension package
run: pnpm run zip
- name: Determine release tag
id: release
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "tag=${{ github.event.inputs.tag }}" >> "$GITHUB_OUTPUT"
else
echo "tag=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT"
fi
- name: Upload package to release
uses: softprops/action-gh-release@v2
with:
files: package/*.zip
tag_name: ${{ steps.release.outputs.tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}