Bump Version and Release #75
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: Bump Version and Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Tag version (e.g., 1.0.0 or v1.0.0)' | |
required: true | |
message: | |
description: 'Tag message' | |
required: true | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.PAT }} | |
- uses: pnpm/action-setup@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: .node-version | |
cache: pnpm | |
- run: pnpm install | |
- run: pnpm run build | |
- name: Set up Git | |
run: | | |
git config --global user.name 'Bryan Lee' | |
git config --global user.email '[email protected]' | |
- name: Determine tag version | |
id: determine_version | |
run: | | |
VERSION="${{ github.event.inputs.version }}" | |
if [[ $VERSION != v* ]]; then | |
VERSION="v$VERSION" | |
fi | |
echo "version=$VERSION" >> $GITHUB_ENV | |
- name: Package plugin | |
run: | | |
VERSION="${{ env.version }}" | |
VERSION_NUMBER="${VERSION#v}" | |
mkdir release && zip -j -r release/openai-translator-${VERSION_NUMBER}.bobplugin ./dist/* | |
- name: Update appcast.json and info.json | |
env: | |
VERSION: ${{ env.version }} | |
MESSAGE: ${{ github.event.inputs.message }} | |
run: | | |
VERSION_NUMBER="${VERSION#v}" | |
python3 scripts/update_release.py "$VERSION_NUMBER" "$MESSAGE" | |
- name: Commit files | |
run: | | |
git commit -a -m 'chore: update appcast.json and info.json' | |
- name: Create tag | |
env: | |
VERSION: ${{ env.version }} | |
MESSAGE: ${{ github.event.inputs.message }} | |
run: | | |
git tag -a "$VERSION" -m "$MESSAGE" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.PAT }} | |
tags: true | |
- name: Upload binaries to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
release_name: ${{ github.ref_name }} | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: release/openai-translator-${VERSION_NUMBER}.bobplugin | |
asset_name: openai-translator-${VERSION_NUMBER}.bobplugin | |
tag: ${{ github.ref_name }} | |
overwrite: true | |
body: ${{ github.event.inputs.message }} |