Nightly Build and Release (3:00, UTC+8) #3
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: "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_exists=$(gh release list --json tagName --jq '.[] | select(.tagName=="nightly") | .tagName') | |
if [ -z "$release_exists" ]; then | |
gh release create nightly \ | |
--prerelease \ | |
--title "Nightly Release" \ | |
--notes "> 这是机器人的 Nightly 版本,本项目已不再提供正式版本。 \n> 请点击 `Assets -> Source code` 下载机器人源代码。" | |
else | |
gh release delete nightly -y | |
gh release create nightly \ | |
--prerelease \ | |
--title "Nightly Release" \ | |
--notes "> 这是机器人的 Nightly 版本,本项目已不再提供正式版本。 \n> 请点击 `Assets -> Source code` 下载机器人源代码。" | |
fi |