Merge pull request #6 from WLaoDuo/master #48
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: goreleaser-actions | |
#https://github.com/goreleaser/goreleaser-action | |
#https://goreleaser.com/customization/builds/ 文档 | |
on: | |
push: | |
branches: | |
- dev | |
tags: | |
- "v*" | |
# permissions: | |
# contents: read #write | |
jobs: | |
goreleaser-actions: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- | |
name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '>=1.21.6' | |
- run: go version | |
- | |
name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v6 #https://github.com/goreleaser/goreleaser-action | |
with: | |
distribution: goreleaser | |
version: "~> v2" # or 'latest', 'nightly', semver | |
args: release --clean #--snapshot 不正式版本,取消git tag校验 --clean清空dist目录 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Github Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') #git push origin本地分支 release远程分支 v5.0版本号 | |
with: | |
# prerelease: ${{ contains(env.GIT_TAG, 'rc') }} | |
# files: './dist/*' | |
files: | | |
./dist/* | |
./dist/simple_file_download_server[\w\.\-\_]+_checksums.txt | |
!./dist/[\w]+\.[json|yaml]+ | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Upload assets | |
uses: actions/upload-artifact@v4 | |
#https://github.com/actions/upload-artifact | |
with: | |
name: simple_file_download_server | |
# path: ./dist/* #全部文件一股脑打包,太臃肿 | |
path: | | |
./dist/*.tar.gz | |
./dist/*.zip | |
./dist/simple_file_download_server[\w\.\-\_]+_checksums.txt | |
# # .github/workflows/release.yml | |
# name: go原生编译 | |
# on: | |
# workflow_dispatch: | |
# inputs: | |
# platform: | |
# description: 'platform' | |
# required: true | |
# default: 'ubuntu-20.04' | |
# type: choice | |
# options: | |
# - 'windows-latest' | |
# - 'macos-latest' | |
# - 'ubuntu-20.04' | |
# jobs: | |
# buildAndDeploy: | |
# runs-on: ubuntu-20.04 | |
# # 交叉构建,多平台交叉编译 | |
# strategy: | |
# matrix: | |
# include: | |
# - goarch: amd64 | |
# goos: linux | |
# - goarch: amd64 | |
# goos: darwin | |
# - goarch: amd64 | |
# goos: windows | |
# # 使用checkout | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - name: Set up Go | |
# uses: actions/setup-go@v3 | |
# with: | |
# go-version: '>=1.16.0' | |
# - run: go version | |
# - name: make | |
# run: go build -o ./out/ ./webdemo.go | |
# env: | |
# GOOS: ${{ matrix.goos }} | |
# GOARCH: ${{ matrix.goarch }} | |
# CGO_ENABLED: 0 | |
# # - name: Packaging... | |
# # run: tar czf nodeUpgrade-${{ matrix.goos }}-${{ matrix.goarch }}.tgz nodeUpgrade | |
# - name: Upload archive | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: output-${{ inputs.platform }}.zip | |
# path: ./out/* | |
# retention-days: 3 |