Skip to content

Commit

Permalink
Create nightly-build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
DoroWolf authored Dec 21, 2024
1 parent aba8a81 commit 63ebc43
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflow/nightly-build.yml
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

0 comments on commit 63ebc43

Please sign in to comment.