-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: migrate project to TypeScript and Rollup
- Loading branch information
Showing
25 changed files
with
1,749 additions
and
1,318 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
name: Release | ||
name: Bump Version and Release | ||
|
||
on: | ||
push: | ||
tags: [ v\d+\.\d+\.\d+ ] | ||
|
||
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: | ||
|
@@ -14,56 +19,72 @@ jobs: | |
packages: write | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ secrets.PAT }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- uses: pnpm/action-setup@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: .node-version | ||
cache: pnpm | ||
|
||
- name: Get version | ||
id: get_version | ||
uses: battila7/get-version-action@v2 | ||
- run: pnpm install | ||
- run: pnpm run build | ||
|
||
- name: Get tag message | ||
id: tag | ||
- name: Set up Git | ||
run: | | ||
git fetch --depth=1 origin +refs/tags/*:refs/tags/* | ||
echo "message=$(git tag -l --format='%(contents:subject)' ${{ steps.get_version.outputs.version }})" >> $GITHUB_OUTPUT | ||
git config --global user.name 'GitHub Actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
- name: Change version | ||
- name: Determine tag version | ||
id: determine_version | ||
run: | | ||
OLD_VERSION=$(grep '"version":' src/info.json | awk -F\" '{print $4}') | ||
sed -i "s/$OLD_VERSION/${{ steps.get_version.outputs.version-without-v }}/" src/info.json | ||
VERSION="${{ github.event.inputs.version }}" | ||
if [[ $VERSION != v* ]]; then | ||
VERSION="v$VERSION" | ||
fi | ||
echo "version=$VERSION" >> $GITHUB_ENV | ||
- name: Package plugin | ||
run: mkdir release && zip -j -r release/openai-translator-${{ steps.get_version.outputs.version-without-v }}.bobplugin ./src/* | ||
|
||
- run: git checkout -- src/ | ||
run: | | ||
VERSION="${{ env.version }}" | ||
VERSION_NUMBER="${VERSION#v}" | ||
mkdir release && zip -j -r release/openai-translator-${VERSION_NUMBER}.bobplugin ./dist/* | ||
- name: Update appcast.json | ||
- name: Update appcast.json and info.json | ||
env: | ||
VERSION: ${{ steps.get_version.outputs.version-without-v }} | ||
MESSAGE: ${{ steps.tag.outputs.message }} | ||
VERSION: ${{ env.version }} | ||
MESSAGE: ${{ github.event.inputs.message }} | ||
run: | | ||
python3 scripts/update_release.py "$VERSION" "$MESSAGE" | ||
VERSION_NUMBER="${VERSION#v}" | ||
python3 scripts/update_release.py "$VERSION_NUMBER" "$MESSAGE" | ||
- name: Commit files | ||
run: | | ||
git config --global user.name 'Bryan Lee' | ||
git config --global user.email '[email protected]' | ||
git commit -am 'chore: update appcast.json and info.json' | ||
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 }} | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
tags: true | ||
|
||
- name: Upload binaries to release | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
release_name: ${{ steps.get_version.outputs.version }} | ||
release_name: ${{ github.ref_name }} | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: release/openai-translator-${{ steps.get_version.outputs.version-without-v }}.bobplugin | ||
asset_name: openai-translator-${{ steps.get_version.outputs.version-without-v }}.bobplugin | ||
tag: ${{ github.ref }} | ||
file: release/openai-translator-${VERSION_NUMBER}.bobplugin | ||
asset_name: openai-translator-${VERSION_NUMBER}.bobplugin | ||
tag: ${{ github.ref_name }} | ||
overwrite: true | ||
body: ${{ steps.tag.outputs.message }} | ||
body: ${{ github.event.inputs.message }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
*.bobplugin | ||
*.log* | ||
dist | ||
node_modules |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
20.16.0 |
Oops, something went wrong.