add README #3
Workflow file for this run
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: Release | |
on: | |
push: | |
# branches: [ main ] | |
tags: [ v\d+\.\d+\.\d+ ] | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.PAT }} | |
- name: Get version | |
id: get_version | |
uses: battila7/get-version-action@v2 | |
- name: Get tag message | |
id: tag | |
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 | |
- name: Change 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 | |
- name: Package plugin | |
run: mkdir release && zip -j -r release/chatglm-translator-${{ steps.get_version.outputs.version-without-v }}.bobplugin ./src/* | |
- run: git checkout -- src/ | |
- name: Update appcast.json | |
env: | |
VERSION: ${{ steps.get_version.outputs.version-without-v }} | |
MESSAGE: ${{ steps.tag.outputs.message }} | |
run: | | |
python3 scripts/update_release.py "$VERSION" "$MESSAGE" | |
- name: Commit files | |
run: | | |
git config --global user.name 'WhyMeta' | |
git config --global user.email '[email protected]' | |
git commit -am '😡Annoyed: update appcast.json and info.json' | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.PAT }} | |
- name: Upload binaries to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
release_name: ${{ steps.get_version.outputs.version }} | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: release/chatglm-translator-${{ steps.get_version.outputs.version-without-v }}.bobplugin | |
asset_name: chatglm-translator-${{ steps.get_version.outputs.version-without-v }}.bobplugin | |
tag: ${{ github.ref }} | |
overwrite: true | |
body: ${{ steps.tag.outputs.message }} |