-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (35 loc) · 1.3 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: Build
on:
push:
branches: [ main ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.21.x]
os: [linux, darwin, windows]
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Extract project version
id: project_version
run: echo "::set-output name=version::$(grep 'const version =' colorexp.go | cut -d '"' -f 2)"
- name: Extract commit hash
id: git_commit
run: echo "::set-output name=sha::$(git rev-parse --short HEAD)"
- name: Download dependencies
run: go mod tidy
- name: Build
run: |
env GOOS=${{ matrix.os }} GOARCH=amd64 go build -o colorexp-${{ matrix.os }}-amd64-${{ steps.project_version.outputs.version }}-${{ steps.git_commit.outputs.sha }} colorexp.go
- name: Upload artifact
if: github.event_name == 'push'
uses: actions/upload-artifact@v4
with:
name: colorexp-${{ matrix.os }}-amd64-${{ steps.project_version.outputs.version }}-${{ steps.git_commit.outputs.sha }}
path: colorexp-${{ matrix.os }}-amd64-${{ steps.project_version.outputs.version }}-${{ steps.git_commit.outputs.sha }}