-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (45 loc) · 1.07 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Build
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
workflow_call:
inputs:
goos:
type: string
goarch:
type: string
go:
type: string
permissions:
contents: read
env:
CGO_ENABLED: 0
GOOS: ${{ inputs.goos || 'linux' }}
GOARCH: ${{ inputs.goarch || 'amd64' }}
jobs:
build:
name: Build caddy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ inputs.go || '~1.22.1' }}
- name: Build Caddy
run: |
GOOS=$GOOS GOARCH=$GOARCH go build \
-o "caddy-$GOOS-$GOARCH"
- if: env.GOOS == 'linux' && env.GOARCH == 'amd64'
name: Show build info
run: |
./caddy-$GOOS-$GOARCH build-info
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: caddy-${{ env.GOOS }}-${{ env.GOARCH }}
path: caddy-${{ env.GOOS }}-${{ env.GOARCH }}