generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 1
50 lines (43 loc) · 1.28 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
name: Publish scaffolder
on:
release:
types: [published]
defaults:
run:
shell: bash
jobs:
deploy:
runs-on: [ubuntu-22.04]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v4
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 ..."
GOOS=$os GOARCH=$arch go build -o $file -ldflags "-X main.version=${{ github.event.release.tag_name }}" ./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