forked from opentdf/platform
-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (35 loc) · 1.29 KB
/
build.yaml
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
# This is a GitHub action that will have two jobs: build and publish
# The build job will create a Golang Docker image with a production target for multiple architectures
# The publishing job will push the image to GitHub packages with the commit sha and build number as labels
# The image will also have some metadata labels about the build
# act --secret-file act.env --container-architecture linux/amd64 --workflows .github/workflows/build.yaml
name: build
on:
push:
jobs:
# This job will build the image using ubuntu
binary:
runs-on: ubuntu-latest
steps:
# Checkout the code from the repository
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.22
cache-dependency-path: |
protocol/go/go.sum
lib/ocrypto/go.sum
sdk/go.sum
service/go.sum
# Build a linux application
- name: Build Service
# Build optimized
run: |
CGO_ENABLED=1 GOARCH=amd64 GOOS=linux go build -o tdfsvc -a -installsuffix=cgo -ldflags="-s -w -extldflags -static" service/main.go
- name: Upload Go binary
uses: actions/upload-artifact@v4
with:
name: tdfsvc-${{ github.sha }}
path: ./tdfsvc