generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 1
54 lines (47 loc) · 1.62 KB
/
publish-scaffold.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Publish scaffold
on:
release:
types: [published]
defaults:
run:
shell: bash
jobs:
deploy:
runs-on: [ubuntu-24.04]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Build
run: |
mkdir -p bin
for os in linux darwin; do
for arch in amd64 arm64; do
file=bin/scaffold-$os-$arch
echo "Building $file ..."
LDFLAGS=""
LDFLAGS+=" -X \"github.com/sap/component-operator-runtime/internal/version.version=${{ github.event.release.tag_name }}\""
LDFLAGS+=" -X \"github.com/sap/component-operator-runtime/internal/version.gitCommit=${{ github.sha }}\""
LDFLAGS+=" -X \"github.com/sap/component-operator-runtime/internal/version.gitTreeState=clean\""
CGO_ENABLED=0 GOOS=$os GOARCH=$arch go build -o $file -ldflags "$LDFLAGS" ./scaffold
done
done
- name: Upload
run: |
for os in linux darwin; do
for arch in amd64 arm64; do
upload_url="${{ github.event.release.upload_url }}"
upload_url=${upload_url%%\{*\}}
file=bin/scaffold-$os-$arch
echo "Uploading $file to $upload_url ..."
curl -sSf \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: $(file -b --mime-type $file)" \
--data-binary @$file \
"$upload_url?name=$(basename $file)"
done
done