Skip to content

Commit

Permalink
Refactor Go project release workflow and update Go version to 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaozhou26 committed Apr 7, 2024
1 parent f500d85 commit 9848972
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
- 'v*'

jobs:

build:
name: Build
runs-on: ubuntu-latest
Expand All @@ -17,10 +16,10 @@ jobs:
arch: [amd64, arm64]
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}

Expand All @@ -30,30 +29,35 @@ jobs:
- name: Package
run: |
tar -czvf ${{ github.event.repository.name }}_${{ matrix.os }}_${{ matrix.arch }}.tar.gz ${{ github.event.repository.name }}_${{ matrix.os }}_${{ matrix.arch }}
TAG_NAME=${GITHUB_REF##*/}
tar -czvf ${{ github.event.repository.name }}_${{ matrix.os }}_${{ matrix.arch }}_${TAG_NAME}.tar.gz ${{ github.event.repository.name }}_${{ matrix.os }}_${{ matrix.arch }}
- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v2
with:
name: ${{ github.event.repository.name }}_${{ matrix.os }}_${{ matrix.arch }}
path: ${{ github.event.repository.name }}_${{ matrix.os }}_${{ matrix.arch }}.tar.gz
name: ${{ github.event.repository.name }}_${{ matrix.os }}_${{ matrix.arch }}_${{ github.ref_name }}.tar.gz
path: ${{ github.event.repository.name }}_${{ matrix.os }}_${{ matrix.arch }}_${{ github.ref_name }}.tar.gz

release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v2

- name: Create Release
uses: softprops/action-gh-release@v1
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GHCR_PAT }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
files: |
${{ github.event.repository.name }}_linux_amd64.tar.gz
${{ github.event.repository.name }}_linux_arm64.tar.gz
${{ github.event.repository.name }}_windows_amd64.tar.gz
${{ github.event.repository.name }}_windows_arm64.tar.gz
${{ github.event.repository.name }}_darwin_amd64.tar.gz
${{ github.event.repository.name }}_darwin_arm64.tar.gz
env:
GHCR_PAT: ${{ secrets.GHCR_PAT }}
${{ github.event.repository.name }}_linux_amd64_${{ github.ref_name }}.tar.gz
${{ github.event.repository.name }}_linux_arm64_${{ github.ref_name }}.tar.gz
${{ github.event.repository.name }}_windows_amd64_${{ github.ref_name }}.tar.gz
${{ github.event.repository.name }}_windows_arm64_${{ github.ref_name }}.tar.gz
${{ github.event.repository.name }}_darwin_amd64_${{ github.ref_name }}.tar.gz
${{ github.event.repository.name }}_darwin_arm64_${{ github.ref_name }}.tar.gz

0 comments on commit 9848972

Please sign in to comment.