v0.3.60 #92
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |