Merge pull request #810 from p5/attach-binaries-to-release
This commit is contained in:
commit
1a458c18b0
35
.github/workflows/go.yml
vendored
35
.github/workflows/go.yml
vendored
@ -2,14 +2,18 @@ name: Go Build and Release
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "main" ]
|
branches: ["main"]
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ "main" ]
|
branches: ["main"]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build binaries for Windows, macOS, and Linux
|
name: Build binaries for Windows, macOS, and Linux
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
@ -20,32 +24,36 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: '1.22.1'
|
go-version-file: ./go.mod
|
||||||
|
|
||||||
- name: Build binary on Linux and macOS
|
- name: Build binary on Linux and macOS
|
||||||
if: matrix.os != 'windows-latest'
|
if: matrix.os != 'windows-latest'
|
||||||
|
env:
|
||||||
|
OS: ${{ matrix.os == 'ubuntu-latest' && 'linux' || 'darwin' }}
|
||||||
|
GOOS: ${{ matrix.os == 'ubuntu-latest' && 'linux' || 'darwin' }}
|
||||||
|
GOARCH: ${{ matrix.arch }}
|
||||||
run: |
|
run: |
|
||||||
GOOS=${{ matrix.os == 'ubuntu-latest' && 'linux' || 'darwin' }} \
|
go build -o fabric-${OS}-${{ matrix.arch }}-${{ github.ref_name }} .
|
||||||
GOARCH=${{ matrix.arch }} \
|
|
||||||
go build -o fabric-${{ matrix.os }}-${{ matrix.arch }}-${{ github.ref_name }} .
|
|
||||||
|
|
||||||
- name: Build binary on Windows
|
- name: Build binary on Windows
|
||||||
if: matrix.os == 'windows-latest'
|
if: matrix.os == 'windows-latest'
|
||||||
|
env:
|
||||||
|
OS: windows
|
||||||
|
GOOS: windows
|
||||||
|
GOARCH: ${{ matrix.arch }}
|
||||||
run: |
|
run: |
|
||||||
$env:GOOS = 'windows'
|
go build -o fabric-${OS}-${{ matrix.arch }}-${{ github.ref_name }} .
|
||||||
$env:GOARCH = '${{ matrix.arch }}'
|
|
||||||
go build -o fabric-${{ matrix.os }}-${{ matrix.arch }}-${{ github.ref_name }} .
|
|
||||||
|
|
||||||
- name: Create DMG for macOS
|
- name: Create DMG for macOS
|
||||||
if: matrix.os == 'macos-latest'
|
if: matrix.os == 'macos-latest'
|
||||||
run: |
|
run: |
|
||||||
mkdir dist
|
mkdir dist
|
||||||
mv fabric-macos-latest-${{ matrix.arch }}-${{ github.ref_name }} dist/fabric
|
cp fabric-macos-latest-${{ matrix.arch }}-${{ github.ref_name }} dist/fabric
|
||||||
hdiutil create dist/fabric-${{ matrix.arch }}.dmg -volname "fabric" -srcfolder dist/fabric
|
hdiutil create dist/fabric-${{ matrix.arch }}.dmg -volname "fabric" -srcfolder dist/fabric
|
||||||
mv dist/fabric-${{ matrix.arch }}.dmg fabric-macos-${{ matrix.arch }}-${{ github.ref_name }}.dmg
|
mv dist/fabric-${{ matrix.arch }}.dmg fabric-macos-${{ matrix.arch }}-${{ github.ref_name }}.dmg
|
||||||
|
|
||||||
@ -56,3 +64,8 @@ jobs:
|
|||||||
path: |
|
path: |
|
||||||
fabric-${{ matrix.os }}-${{ matrix.arch }}-${{ github.ref_name }}
|
fabric-${{ matrix.os }}-${{ matrix.arch }}-${{ github.ref_name }}
|
||||||
fabric-macos-${{ matrix.arch }}-${{ github.ref_name }}.dmg
|
fabric-macos-${{ matrix.arch }}-${{ github.ref_name }}.dmg
|
||||||
|
|
||||||
|
- name: Upload release artifact
|
||||||
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
||||||
|
run: |
|
||||||
|
gh release upload ${{ github.ref_name }} fabric-*-${{ matrix.arch }}-${{ github.ref_name }}*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user