Merge pull request #13 from nginxinc/areste #8
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: Build and Release | |
on: | |
push: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.22.4' | |
- name: Build | |
run: | | |
BUILD=$(git log --format='%H' -n 1) | |
VERSION="dev" | |
GOOS=linux GOARCH=amd64 go build -ldflags "-w -s -X github.com/nginxinc/nginx-k8s-supportpkg/pkg/version.Build=$BUILD\ | |
-X github.com/nginxinc/nginx-k8s-supportpkg/pkg/version.Version=$VERSION" -o release/kubectl-nginx_supportpkg | |
tar czvf release/kubectl-nginx-supportpkg_${VERSION}_linux_amd64.tar.gz -C release kubectl-nginx_supportpkg | |
GOOS=linux GOARCH=arm64 go build -ldflags "-w -s -X github.com/nginxinc/nginx-k8s-supportpkg/pkg/version.Build=$BUILD\ | |
-X github.com/nginxinc/nginx-k8s-supportpkg/pkg/version.Version=$VERSION" -o release/kubectl-nginx_supportpkg | |
tar czvf release/kubectl-nginx-supportpkg_${VERSION}_linux_arm64.tar.gz -C release kubectl-nginx_supportpkg | |
GOOS=darwin GOARCH=amd64 go build -ldflags "-w -s -X github.com/nginxinc/nginx-k8s-supportpkg/pkg/version.Build=$BUILD\ | |
-X github.com/nginxinc/nginx-k8s-supportpkg/pkg/version.Version=$VERSION" -o release/kubectl-nginx_supportpkg | |
tar czvf release/kubectl-nginx-supportpkg_${VERSION}_darwin_amd64.tar.gz -C release kubectl-nginx_supportpkg | |
GOOS=darwin GOARCH=arm64 go build -ldflags "-w -s -X github.com/nginxinc/nginx-k8s-supportpkg/pkg/version.Build=$BUILD\ | |
-X github.com/nginxinc/nginx-k8s-supportpkg/pkg/version.Version=$VERSION" -o release/kubectl-nginx_supportpkg | |
tar czvf release/kubectl-nginx-supportpkg_${VERSION}_darwin_arm64.tar.gz -C release kubectl-nginx_supportpkg | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: release-artifacts | |
path: release/**/*.gz |