ci #48
Workflow file for this run
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: ci | |
on: | |
push: | |
branches: [ "" ] | |
tags: | |
- 'v*' | |
pull_request: | |
branches: [ "" ] | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
description: "用于手动触发测试" | |
required: true | |
default: "true" | |
permissions: | |
contents: write | |
jobs: | |
build: | |
if: ${{ github.repository == 'chaunsin/netease-cloud-music' }} | |
runs-on: ubuntu-latest | |
steps: | |
# Step 0: 检出代码 | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# Step 1: 设置环境变量 | |
- name: Set Env | |
run: | | |
echo "BUILD_TIME=$(date --rfc-3339=seconds --utc)" >> $GITHUB_ENV | |
echo "PREVIOUS_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo '')" >> $GITHUB_ENV | |
echo "COMMIT_HASH=$(echo "${{ github.sha }}" | cut -c 1-7)" >> $GITHUB_ENV | |
# Step 2: 设置 Go 环境 | |
- name: Set up Go environment | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
check-latest: true | |
cache: true | |
# Step 3: 安装xgo以及upx | |
# https://github.com/techknowlogick/xgo | |
- name: Install xgo and upx | |
run: | | |
go install src.techknowlogick.com/xgo@latest | |
#sudo apt-get update | |
#sudo apt-get install upx | |
# Step 4: 打印 changelog | |
- name: Print Changelog | |
run: | | |
echo "Changelog:" | |
echo "${{ steps.changelog.outputs.changelog }}" | |
echo "Compare URL: ${{ steps.changelog.outputs.compareurl }}" | |
echo "GitHub Pages Hash: ${{ steps.changelog.outputs.gh-pages-hash }}" | |
# Step 5: 发布 | |
- name: Run GoReleaser | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
# either 'goreleaser' (default) or 'goreleaser-pro' | |
distribution: goreleaser | |
# 'latest', 'nightly', or a semver | |
version: "~> v2" | |
args: release --clean --release-notes=./note.md | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} | |
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution | |
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} |