Skip to content

Commit

Permalink
goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyiming748 committed Nov 30, 2023
1 parent 04a5222 commit b0b47b8
Showing 1 changed file with 17 additions and 102 deletions.
119 changes: 17 additions & 102 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,112 +13,27 @@ on:
branches: [ "master" ]
name: Latest Release

defaults:
run:
shell: bash

jobs:
lint:
name: Lint files
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.16.3'
- name: golangci-lint
uses: golangci/[email protected]
with:
version: latest
test:
name: Run tests
runs-on: 'ubuntu-latest'
needs: lint
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.16.3'
- run: go test -v -cover
release:
name: Create Release
runs-on: 'ubuntu-latest'
needs: test
strategy:
matrix:
goosarch:
- 'aix/ppc64'
# - 'android/386'
- 'android/amd64'
# - 'android/arm'
- 'android/arm64'
- 'darwin/amd64'
- 'darwin/arm64'
- 'dragonfly/amd64'
- 'freebsd/386'
- 'freebsd/amd64'
- 'freebsd/arm'
- 'freebsd/arm64'
- 'illumos/amd64'
# - 'ios/amd64'
# - 'ios/arm64'
- 'js/wasm'
- 'linux/386'
- 'linux/amd64'
- 'linux/arm'
- 'linux/arm64'
- 'linux/mips'
- 'linux/mips64'
- 'linux/mips64le'
- 'linux/mipsle'
- 'linux/ppc64'
- 'linux/ppc64le'
- 'linux/riscv64'
- 'linux/s390x'
- 'netbsd/386'
- 'netbsd/amd64'
- 'netbsd/arm'
- 'netbsd/arm64'
- 'openbsd/386'
- 'openbsd/amd64'
- 'openbsd/arm'
- 'openbsd/arm64'
- 'openbsd/mips64'
- 'plan9/386'
- 'plan9/amd64'
- 'plan9/arm'
- 'solaris/amd64'
- 'windows/386'
- 'windows/amd64'
- 'windows/arm'
build:
name: GoReleaser build
runs-on: ubuntu-latest

steps:
- name: Checkout code
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-go@v2
fetch-depth: 0 # See: https://goreleaser.com/ci/actions/

- name: Set up Go 1.21.4
uses: actions/setup-go@v2
with:
go-version: '1.21.4'
- name: Get OS and arch info
run: |
GOOSARCH=${{matrix.goosarch}}
GOOS=${GOOSARCH%/*}
GOARCH=${GOOSARCH#*/}
BINARY_NAME=${{github.repository}}-$GOOS-$GOARCH
echo "BINARY_NAME=$BINARY_NAME" >> $GITHUB_ENV
echo "GOOS=$GOOS" >> $GITHUB_ENV
echo "GOARCH=$GOARCH" >> $GITHUB_ENV
- name: Build
run: |
go build -o "$BINARY_NAME" -v
- name: Release Notes
run:
git log $(git describe HEAD~ --tags --abbrev=0)..HEAD --pretty='format:* %h %s%n * %an <%ae>' --no-merges >> ".github/RELEASE-TEMPLATE.md"
- name: Release with Notes
uses: softprops/action-gh-release@v1
go-version: 1.21.4
id: go

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@master
with:
body_path: ".github/RELEASE-TEMPLATE.md"
draft: true
files: ${{env.BINARY_NAME}}
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GO_RELEASER_GITHUB_TOKEN }}

0 comments on commit b0b47b8

Please sign in to comment.