-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
81 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// 读取 package.json | ||
import pkg from "../../../package.json" assert { type: "json" }; | ||
|
||
// 读取 version.txt | ||
let version = await Deno.readTextFile("../version.txt"); | ||
if (version === pkg.version) { | ||
console.log("版本号一致,无需更新"); | ||
Deno.exit(0); | ||
} | ||
const oldVersion = version; | ||
|
||
// 写入 version.txt | ||
version = pkg.version; | ||
await Deno.writeTextFile("../version.txt", version); | ||
|
||
// 替换 replaceList 中的版本号 | ||
const replaceList = [ | ||
"../../../README.md" | ||
] | ||
|
||
for (const file of replaceList) { | ||
let readme = await Deno.readTextFile(file); | ||
readme = readme.replaceAll(oldVersion, version); | ||
await Deno.writeTextFile(file, readme); | ||
} | ||
|
||
// 创建 needUpdate.txt | ||
// await Deno.writeTextFile("../needUpdate.txt", version); |
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 @@ | ||
0.3.0 |
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,51 @@ | ||
# 自动标注 Tag | ||
name: Auto Tag | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
branches: [master] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
update: | ||
name: Auto Tag | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Deno | ||
uses: denoland/setup-deno@v1 | ||
with: | ||
deno-version: v1.x | ||
- name: Get current version | ||
id: current_version | ||
run: echo "version=$(cat .github/AutoWriteVersion/version.txt)" >> $GITHUB_OUTPUT | ||
- name: Check Version | ||
id: check_version | ||
run: | | ||
cd .github/AutoWriteVersion/src/ | ||
deno run --allow-read --allow-write main.ts | ||
- name: Get new version | ||
id: new_version | ||
run: echo "version=$(cat .github/AutoWriteVersion/version.txt)" >> $GITHUB_OUTPUT | ||
- name: Check Version | ||
if: steps.check_version.outputs.version != steps.current_version.outputs.version | ||
run: | | ||
echo "New Version: ${{ steps.new_version.outputs.version }}" | ||
- name: Import GPG key | ||
uses: crazy-max/ghaction-import-gpg@v5 | ||
with: | ||
gpg_private_key: ${{ secrets.GH_GPG }} | ||
passphrase: '' | ||
git_config_global: true | ||
git_user_signingkey: true | ||
git_commit_gpgsign: true | ||
git_tag_gpgsign: true | ||
- name: Commit and Set Tag | ||
run: | | ||
git add . | ||
git commit -m "chore(workflow): update version to ${{ steps.new_version.outputs.version }}" | ||
git tag -a ${{ steps.new_version.outputs.version }} -m "chore(workflow): update version to ${{ steps.new_version.outputs.version }}" | ||
git push --follow-tags |
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