-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
1 changed file
with
52 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: "Nightly Build and Release (3:00, UTC+8)" | ||
|
||
on: | ||
schedule: | ||
- cron: '0 3 * * *' | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
nightly: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Delete nightly tag | ||
run: | | ||
if git rev-parse refs/tags/nightly >/dev/null 2>&1; then | ||
git push origin :refs/tags/nightly | ||
else | ||
echo "Tag `nightly` is not found" | ||
fi | ||
- name: Create new nightly tag | ||
run: | | ||
git tag nightly | ||
git push origin nightly | ||
- name: Update pre-release version | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
release_id=$(gh release list --json id,tagName --jq '.[] | select(.tagName=="nightly") | .id') | ||
if [ -z "$release_id" ]; then | ||
gh release create nightly \ | ||
--prerelease \ | ||
--title "Nightly Release" \ | ||
--notes "> 这是机器人的 Nightly 版本,本项目不再提供正式版本。\n> 请点击 Assets-Source code 下载机器人源代码。" \ | ||
--generate-notes | ||
else | ||
gh release delete nightly -y | ||
gh release create nightly \ | ||
--prerelease \ | ||
--title "Nightly Release" \ | ||
--notes "> 这是机器人的 Nightly 版本,本项目不再提供正式版本。\n> 请点击 Assets-Source code 下载机器人源代码。" \ | ||
--generate-notes | ||
fi |