From f2c623a6fe2fed4791d419fc8c274a0b3ea4e18a Mon Sep 17 00:00:00 2001 From: chaunsin <906591446@qq.com> Date: Sat, 8 Feb 2025 16:12:48 +0800 Subject: [PATCH 1/3] =?UTF-8?q?ci:=20=E8=B0=83=E6=95=B4ci=E5=8F=91?= =?UTF-8?q?=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 150 ++-------------------- .github/workflows/ci.yml.bak | 198 +++++++++++++++++++++++++++++ .github/workflows/deploy_image.yml | 2 +- .gitignore | 1 + .goreleaser.yaml | 113 ++++++++++++++++ go.mod | 8 +- go.sum | 16 +-- 7 files changed, 339 insertions(+), 149 deletions(-) create mode 100644 .github/workflows/ci.yml.bak create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 083ff55..689bab3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,111 +51,7 @@ jobs: #sudo apt-get update #sudo apt-get install upx - # Step 4: 编译项目 - - name: Cross-Compile using xgo - run: | - mkdir -p output - go env -w CGO_ENABLED=0 - xgo --targets=darwin-10.14/*,windows-6.1/*,linux/amd64,linux/arm64,linux/mips64,linux/mips64le,linux/ppc64le,linux/riscv64 \ - --ldflags "-extldflags "-static" -s -w -X 'main.BuildTime=${{ env.BUILD_TIME }}' -X 'main.Version=${{github.ref_name}}' -X 'main.Commit=${{ env.COMMIT_HASH }}'" \ - -out output/ncmctl ./cmd/ncmctl/main.go - echo "Build output:" - tree ./output - - # Step 5: 压缩文件 - - name: Compress and upload binaries - run: | - cp LICENSE output/LICENSE - - for file in output/*; do - filename=$(basename "$file") - ext="${filename##*.}" - - if [[ "$filename" == "LICENSE" ]]; then - continue - fi - - if [[ "$ext" == "exe" ]]; then - new_name="ncmctl.exe" - else - new_name="ncmctl" - fi - - mv "$file" "output/$new_name" - - ## 使用 UPX 压缩文件 - #if [[ -x "output/$new_name" ]]; then - # upx --best "output/$new_name" - # file "output/$new_name" - #else - # echo "Skipping UPX for non-executable file: $new_name" - # continue - #fi - - sha256_file="output/checksum.sha256" - # 去掉路径,仅保留文件名 - sha256sum "output/$new_name" | sed "s|output/||" > "$sha256_file" - echo "SHA256 for $filename: $(cat "$sha256_file")" - - tarball="output/${filename}.tar.gz" - tar -czf "$tarball" output/"$new_name" output/checksum.sha256 output/LICENSE - - rm -f "output/$new_name" "output/checksum.sha256" - done - - # Step 6: 上传压缩包 - # https://github.com/actions/upload-artifact - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: artifacts - path: ./output - if-no-files-found: error - - # Step 7: 下载压缩包 - # https://github.com/actions/download-artifact - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - pattern: artifacts* - path: ./output - merge-multiple: true - - # Step 8: 输出当前ref和生成的文件列表 - - name: Debug Release - run: | - echo "Current ref: ${{ github.ref }}" - echo "Generated artifacts:" - tree ./output - - # Step 9: 生成 changelog - # https://github.com/jaywcjlove/changelog-generator - - name: Generate changelog - id: changelog - uses: jaywcjlove/changelog-generator@main - #if: env.PREVIOUS_TAG - with: - token: ${{ secrets.GITHUB_TOKEN }} - head-ref: ${{ env.PREVIOUS_TAG }} - filter-author: (dependabot|renovate\\[bot\\]|dependabot\\[bot\\]|Renovate Bot) - filter: '[R|r]elease[d]\s+[v|V]\d(\.\d+){0,2}' - template: | - ## Bugs - {{fix,bug}} - ## Feature - {{feat,feature}} - ## Improve - {{refactor,perf,clean,optimize}} - ## Deprecated - {{deprecated}} - ## Golang Dependencies - {{depend,dep,deps}} - ## Misc - {{chore,style,ci,docs,doc,test,script||🔶 Nothing change}} - ## Other - {{__unknown__}} - - # Step 10: 打印 changelog + # Step 4: 打印 changelog - name: Print Changelog run: | echo "Changelog:" @@ -163,36 +59,18 @@ jobs: echo "Compare URL: ${{ steps.changelog.outputs.compareurl }}" echo "GitHub Pages Hash: ${{ steps.changelog.outputs.gh-pages-hash }}" - # Step 11: 发布 - # https://github.com/softprops/action-gh-release - - name: Create Release + # Step 5: 发布 + - name: Run GoReleaser if: startsWith(github.ref, 'refs/tags/v') - uses: softprops/action-gh-release@v2 - with: - files: | - ./output/* - body: | - ${{ steps.changelog.outputs.compareurl }} - ${{ steps.changelog.outputs.changelog }} - name: ${{github.ref_name}} Releases - generate_release_notes: true - fail_on_unmatched_files: true - prerelease: false - draft: false - make_latest: true - token: ${{ secrets.GITHUB_TOKEN }} - - name: Create Debug Release - if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled == 'true' }} - uses: softprops/action-gh-release@v2 + uses: goreleaser/goreleaser-action@v6 with: - files: | - ./output/* - body: | - ${{ steps.changelog.outputs.compareurl }} - ${{ steps.changelog.outputs.changelog }} - name: ${{github.ref_name}} Releases - generate_release_notes: true - fail_on_unmatched_files: true - prerelease: true - draft: true - token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + # 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 }} diff --git a/.github/workflows/ci.yml.bak b/.github/workflows/ci.yml.bak new file mode 100644 index 0000000..083ff55 --- /dev/null +++ b/.github/workflows/ci.yml.bak @@ -0,0 +1,198 @@ +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: 编译项目 + - name: Cross-Compile using xgo + run: | + mkdir -p output + go env -w CGO_ENABLED=0 + xgo --targets=darwin-10.14/*,windows-6.1/*,linux/amd64,linux/arm64,linux/mips64,linux/mips64le,linux/ppc64le,linux/riscv64 \ + --ldflags "-extldflags "-static" -s -w -X 'main.BuildTime=${{ env.BUILD_TIME }}' -X 'main.Version=${{github.ref_name}}' -X 'main.Commit=${{ env.COMMIT_HASH }}'" \ + -out output/ncmctl ./cmd/ncmctl/main.go + echo "Build output:" + tree ./output + + # Step 5: 压缩文件 + - name: Compress and upload binaries + run: | + cp LICENSE output/LICENSE + + for file in output/*; do + filename=$(basename "$file") + ext="${filename##*.}" + + if [[ "$filename" == "LICENSE" ]]; then + continue + fi + + if [[ "$ext" == "exe" ]]; then + new_name="ncmctl.exe" + else + new_name="ncmctl" + fi + + mv "$file" "output/$new_name" + + ## 使用 UPX 压缩文件 + #if [[ -x "output/$new_name" ]]; then + # upx --best "output/$new_name" + # file "output/$new_name" + #else + # echo "Skipping UPX for non-executable file: $new_name" + # continue + #fi + + sha256_file="output/checksum.sha256" + # 去掉路径,仅保留文件名 + sha256sum "output/$new_name" | sed "s|output/||" > "$sha256_file" + echo "SHA256 for $filename: $(cat "$sha256_file")" + + tarball="output/${filename}.tar.gz" + tar -czf "$tarball" output/"$new_name" output/checksum.sha256 output/LICENSE + + rm -f "output/$new_name" "output/checksum.sha256" + done + + # Step 6: 上传压缩包 + # https://github.com/actions/upload-artifact + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: artifacts + path: ./output + if-no-files-found: error + + # Step 7: 下载压缩包 + # https://github.com/actions/download-artifact + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + pattern: artifacts* + path: ./output + merge-multiple: true + + # Step 8: 输出当前ref和生成的文件列表 + - name: Debug Release + run: | + echo "Current ref: ${{ github.ref }}" + echo "Generated artifacts:" + tree ./output + + # Step 9: 生成 changelog + # https://github.com/jaywcjlove/changelog-generator + - name: Generate changelog + id: changelog + uses: jaywcjlove/changelog-generator@main + #if: env.PREVIOUS_TAG + with: + token: ${{ secrets.GITHUB_TOKEN }} + head-ref: ${{ env.PREVIOUS_TAG }} + filter-author: (dependabot|renovate\\[bot\\]|dependabot\\[bot\\]|Renovate Bot) + filter: '[R|r]elease[d]\s+[v|V]\d(\.\d+){0,2}' + template: | + ## Bugs + {{fix,bug}} + ## Feature + {{feat,feature}} + ## Improve + {{refactor,perf,clean,optimize}} + ## Deprecated + {{deprecated}} + ## Golang Dependencies + {{depend,dep,deps}} + ## Misc + {{chore,style,ci,docs,doc,test,script||🔶 Nothing change}} + ## Other + {{__unknown__}} + + # Step 10: 打印 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 11: 发布 + # https://github.com/softprops/action-gh-release + - name: Create Release + if: startsWith(github.ref, 'refs/tags/v') + uses: softprops/action-gh-release@v2 + with: + files: | + ./output/* + body: | + ${{ steps.changelog.outputs.compareurl }} + ${{ steps.changelog.outputs.changelog }} + name: ${{github.ref_name}} Releases + generate_release_notes: true + fail_on_unmatched_files: true + prerelease: false + draft: false + make_latest: true + token: ${{ secrets.GITHUB_TOKEN }} + - name: Create Debug Release + if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled == 'true' }} + uses: softprops/action-gh-release@v2 + with: + files: | + ./output/* + body: | + ${{ steps.changelog.outputs.compareurl }} + ${{ steps.changelog.outputs.changelog }} + name: ${{github.ref_name}} Releases + generate_release_notes: true + fail_on_unmatched_files: true + prerelease: true + draft: true + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/deploy_image.yml b/.github/workflows/deploy_image.yml index 63a228e..1a0d85b 100644 --- a/.github/workflows/deploy_image.yml +++ b/.github/workflows/deploy_image.yml @@ -97,7 +97,7 @@ jobs: # https://github.com/actions/attest-build-provenance - name: Generate artifact attestation - uses: actions/attest-build-provenance@v1 + uses: actions/attest-build-provenance@v2 with: subject-name: ghcr.io/${{ env.IMAGE_NAME}} subject-digest: ${{ steps.bp.outputs.digest }} diff --git a/.gitignore b/.gitignore index fea9e77..35d21d5 100644 --- a/.gitignore +++ b/.gitignore @@ -974,3 +974,4 @@ Temporary Items /data/ /script/qinglong/netease-cloud-music/ /build/ +note.md \ No newline at end of file diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..88c4c10 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,113 @@ +# This is an example .goreleaser.yml file with some sensible defaults. +# Make sure to check the documentation at https://goreleaser.com + +# The lines below are called `modelines`. See `:help modeline` +# Feel free to remove those if you don't want/need to use them. +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj + +version: 2 + +project_name: ncmctl + +# 构建输出目录 +dist: ./build + +before: + hooks: + # You may remove this if you don't use go modules. + - go mod tidy + # you may remove this if you don't need go generate + - go generate ./... + +# https://goreleaser.com/customization/builds/ +builds: + - env: + - CGO_ENABLED=0 + main: ./cmd/ncmctl/ + binary: ncmctl + ldflags: + - -s -w -X "main.Version={{.Version}}" -X "main.Commit={{.ShortCommit}}" -X "main.BuildTime={{.CommitDate}}" + + # Default: [ 'darwin', 'linux', 'windows' ]. + goos: + - linux + - windows + - darwin + - freebsd + - openbsd + - netbsd + + # Default: [ '386', 'amd64', 'arm64' ] + goarch: + - amd64 + - arm + - arm64 + - 386 + - s390x + - ppc64 + - riscv64 + - ppc64le + - mips + - mipsle + - mips64 + - mips64le + - loong64 + + # Default: v1 + goamd64: + - v1 + #- v2 + #- v3 + + # Default: 6 + goarm: + #- 5 + - 6 + #- 7 + + # Default: 'v8.0' + goarm64: + - v8.0 + #- v9.0 + + # Default: hardfloat + gomips: + - hardfloat + #- softfloat + + # Default: sse2 + go386: + - sse2 + #- softfloat + + # Default: power8 + goppc64: + - power8 + #- power9 + + # Default: rva20u64 + goriscv64: + - rva22u64 + +archives: + - formats: [ 'tar.gz' ] + # this name template makes the OS and Arch compatible with the results of `uname`. + name_template: >- + {{ .ProjectName }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} + # use zip for windows archives + format_overrides: + - goos: windows + formats: [ 'zip' ] + +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:" diff --git a/go.mod b/go.mod index 0085f94..e3d83b8 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.9.0 github.com/wneessen/go-mail v0.4.2 - golang.org/x/sync v0.8.0 + golang.org/x/sync v0.10.0 gopkg.in/natefinch/lumberjack.v2 v2.2.1 gopkg.in/yaml.v3 v3.0.1 ) @@ -58,9 +58,9 @@ require ( go.opencensus.io v0.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect - golang.org/x/net v0.30.0 // indirect - golang.org/x/sys v0.26.0 // indirect - golang.org/x/text v0.19.0 // indirect + golang.org/x/net v0.34.0 // indirect + golang.org/x/sys v0.29.0 // indirect + golang.org/x/text v0.21.0 // indirect google.golang.org/protobuf v1.33.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect ) diff --git a/go.sum b/go.sum index e75a67a..c23d30b 100644 --- a/go.sum +++ b/go.sum @@ -176,29 +176,29 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= -golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= +golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= +golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= -golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= -golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= +golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= -golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= From 25f6e48c5d8e45561b2134efd4172359ab67efb0 Mon Sep 17 00:00:00 2001 From: chaunsin <906591446@qq.com> Date: Sat, 8 Feb 2025 16:31:31 +0800 Subject: [PATCH 2/3] ci: update --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 689bab3..436e4f9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,8 +56,9 @@ jobs: run: | echo "Changelog:" echo "${{ steps.changelog.outputs.changelog }}" + echo "${{ steps.changelog.outputs.changelog }}" > note.md echo "Compare URL: ${{ steps.changelog.outputs.compareurl }}" - echo "GitHub Pages Hash: ${{ steps.changelog.outputs.gh-pages-hash }}" + echo "GitHub Pages Hash: ${{ steps.changelog.outputs.gh-pages-hash }}" # Step 5: 发布 - name: Run GoReleaser From afae42e01f33401f7ac18ccc8392160e1263b6ce Mon Sep 17 00:00:00 2001 From: chaunsin <906591446@qq.com> Date: Sat, 8 Feb 2025 16:53:51 +0800 Subject: [PATCH 3/3] ci: fix --- .github/workflows/ci.yml | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 436e4f9..11d3772 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,7 +51,33 @@ jobs: #sudo apt-get update #sudo apt-get install upx - # Step 4: 打印 changelog + # Step 4: 生成 changelog + # https://github.com/jaywcjlove/changelog-generator + - name: Generate changelog + id: changelog + uses: jaywcjlove/changelog-generator@main + with: + token: ${{ secrets.GITHUB_TOKEN }} + head-ref: ${{ env.PREVIOUS_TAG }} + filter-author: (dependabot|renovate\\[bot\\]|dependabot\\[bot\\]|Renovate Bot) + filter: '[R|r]elease[d]\s+[v|V]\d(\.\d+){0,2}' + template: | + ## Bugs + {{fix,bug}} + ## Feature + {{feat,feature}} + ## Improve + {{refactor,perf,clean,optimize}} + ## Deprecated + {{deprecated}} + ## Golang Dependencies + {{depend,dep,deps}} + ## Misc + {{chore,style,ci,docs,doc,test,script||🔶 Nothing change}} + ## Other + {{__unknown__}} + + # Step 5: 打印 changelog - name: Print Changelog run: | echo "Changelog:" @@ -60,7 +86,7 @@ jobs: echo "Compare URL: ${{ steps.changelog.outputs.compareurl }}" echo "GitHub Pages Hash: ${{ steps.changelog.outputs.gh-pages-hash }}" - # Step 5: 发布 + # Step 6: 发布 - name: Run GoReleaser if: startsWith(github.ref, 'refs/tags/v') uses: goreleaser/goreleaser-action@v6