Skip to content

Commit d7fc3f8

Browse files
committed
fix(release): manage other architecture for build
1 parent ff716c2 commit d7fc3f8

File tree

1 file changed

+53
-31
lines changed

1 file changed

+53
-31
lines changed

.github/workflows/release.yml

Lines changed: 53 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,58 @@
11
name: Release
22

33
on:
4-
push:
5-
branches:
6-
- main
4+
push:
5+
branches:
6+
- main
77

8-
jobs:
9-
release:
10-
runs-on: ubuntu-latest
11-
steps:
12-
- uses: actions/checkout@v3
13-
14-
- name: Set up Go
15-
uses: actions/setup-go@v4
16-
with:
17-
go-version: "1.21"
18-
19-
- name: Build
20-
run: |
21-
go build -o venv-manager cmd/venv-manager/main.go
8+
permissions:
9+
contents: write
2210

23-
- name: Get version
24-
id: get_version
25-
run: echo "::set-output name=version::$(date +'%Y.%m.%d')"
26-
27-
- name: Create Release
28-
uses: softprops/action-gh-release@v1
29-
with:
30-
tag_name: v${{ steps.get_version.outputs.version }}
31-
files: |
32-
venv-manager
33-
README.md
34-
LICENSE
35-
env:
36-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11+
jobs:
12+
release:
13+
strategy:
14+
matrix:
15+
include:
16+
- os: ubuntu-latest
17+
arch: amd64
18+
binary: venv-manager
19+
- os: ubuntu-latest
20+
arch: arm64
21+
binary: venv-manager-arm64
22+
- os: windows-latest
23+
arch: amd64
24+
binary: venv-manager.exe
25+
- os: macos-latest
26+
arch: amd64
27+
binary: venv-manager-darwin
28+
- os: macos-latest
29+
arch: arm64
30+
binary: venv-manager-darwin-arm64
31+
32+
runs-on: ${{ matrix.os }}
33+
34+
steps:
35+
- uses: actions/checkout@v3
36+
37+
- uses: actions/setup-go@v4
38+
with:
39+
go-version: '1.21'
40+
41+
- name: Build
42+
env:
43+
GOOS: ${{ matrix.os == 'windows-latest' && 'windows' || matrix.os == 'macos-latest' && 'darwin' || 'linux' }}
44+
GOARCH: ${{ matrix.arch }}
45+
run: |
46+
go build -o ${{ matrix.binary }} cmd/venv-manager/main.go
47+
48+
- name: Get version
49+
id: get_version
50+
run: echo "version=$(date +'%Y.%m.%d')" >> $GITHUB_OUTPUT
51+
52+
- name: Create Release
53+
uses: softprops/action-gh-release@v1
54+
with:
55+
tag_name: v${{ steps.get_version.outputs.version }}
56+
files: ${{ matrix.binary }}
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)