Skip to content

Release

Release #12

Workflow file for this run

name: release
permissions:
checks: write
statuses: write
contents: write
on:
workflow_dispatch:
inputs:
version:
required: true
default: "patch"
type: choice
options:
- major
- minor
- patch
jobs:
bump:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- run: corepack enable
- name: Setup
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: Bump version
id: bump_version
shell: bash
run: |
pnpm version ${{ github.event.inputs.version }} --no-commit-hooks --no-git-tag-version
echo "VERSION=$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT
- id: branch
run: echo "ENV=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
- name: commit
run: |
gh api graphql \
-F githubRepository=${{ github.repository }} \
-F branchName=${{ steps.branch.outputs.ENV }} \
-F expectedHeadOid=$(git rev-parse HEAD) \
-F commitMessage=":robot: Bump version to ${{ steps.bump_version.outputs.VERSION }}" \
-F files[][path]="package.json" -F files[][contents]=$(base64 -w0 package.json) \
-F '[email protected]/api/createCommitOnBranch.gql'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: re:Checkout
uses: actions/checkout@v4
- name: Configure Git
run: |
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
- name: tag
run: git tag v${{ steps.bump_version.outputs.VERSION }}; git push --tags origin ${{ steps.branch.outputs.ENV }}
outputs:
VERSION: v${{ steps.bump_version.outputs.VERSION }}
build:
needs: bump
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: refs/tag/v${{ needs.bump.outputs.VERSION }}
- run: corepack enable
- name: Setup
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- id: version
run: echo "VERSION=$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT
- name: Install
run: pnpm i --frozen-lockfile
- name: Build
run: pnpm zip && pnpm zip:firefox
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version.outputs.VERSION }}
files: .output/*.zip
generate_release_notes: true