Skip to content

Merge pull request #84 from wunderio/feature/chart-extend-update #75

Merge pull request #84 from wunderio/feature/chart-extend-update

Merge pull request #84 from wunderio/feature/chart-extend-update #75

Workflow file for this run

name: Build silta cli binary on push to master branch
on:
push:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
tests-matrix:
name: Tests
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, darwin, windows]
goarch: [amd64, arm64]
steps:
- uses: actions/checkout@v3
- uses: azure/setup-helm@v3
with:
version: 'v3.18.4'
name: Install Helm
- name: Add wunderio Helm repo
run: helm repo add wunderio https://storage.googleapis.com/charts.wdr.io
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.24.4
- name: Run tests
run: go test -v ./tests
releases-matrix:
name: Cross compile and release Go Binaries
runs-on: ubuntu-latest
needs: tests-matrix
strategy:
matrix:
# Release unsigned darwin binaries
goos: [linux, darwin, windows]
goarch: [amd64, arm64]
steps:
- uses: actions/checkout@v3
- name: Auth to GCP
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: Set up gcloud
uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
- name: Set output
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Build binary
run: |
mkdir -p dist
RELEASE_TAG="master"
BIN_NAME="silta-${{ matrix.goos }}-${{ matrix.goarch }}"
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} CGO_ENABLED=0 \
go build -ldflags "-X github.com/wunderio/silta-cli/internal/common.Version=${{ steps.vars.outputs.sha_short }} -s -w" \
-o dist/$BIN_NAME
tar -czf dist/silta-${RELEASE_TAG}-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz \
-C dist $BIN_NAME --transform="s|$BIN_NAME|silta|"
- name: Upload release asset
uses: softprops/action-gh-release@v2
with:
tag_name: "master"
files: dist/silta-master-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload to GCS
run: |
RELEASE_TAG="master"
FILE_NAME="silta-${RELEASE_TAG}-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz"
gsutil cp "dist/$FILE_NAME" \
"gs://${{ secrets.GCP_BUCKET_NAME }}/releases/${RELEASE_TAG}/$FILE_NAME"