Skip to content

nightly-release

nightly-release #113

Workflow file for this run

name: nightly-release
on:
schedule:
# 每天 UTC 时间 00:00 自动触发构建
- cron: "0 0 * * *"
workflow_dispatch:
jobs:
create-nightly-release:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0 # 确保获取所有历史和标签
- name: Configure Git
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
- name: Update 'v0.0.0-nightly' tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# 删除本地和远程的 'v0.0.0-nightly' 标签(如果存在)
git tag -d v0.0.0-nightly || true
git push origin :refs/tags/v0.0.0-nightly || true
# 创建新的 'v0.0.0-nightly' 标签并推送
git tag v0.0.0-nightly
git push origin refs/tags/v0.0.0-nightly
- name: Delete previous nightly release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE: ${{ github.event.issue.html_url }}
run: |
if gh release view v0.0.0-nightly; then
gh release delete v0.0.0-nightly -y
else
echo "Release v0.0.0-nightly not found, skipping delete."
fi
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.21"
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
ref: v0.0.0-nightly
- name: Get dependencies
run: go mod download
- name: GoReleaser Action
uses: goreleaser/goreleaser-action@v5
with:
version: v1.26.2
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}