Skip to content

fix: fix empty list template response (#367) #37

fix: fix empty list template response (#367)

fix: fix empty list template response (#367) #37

Workflow file for this run

name: Branch Build
on:
push:
branches:
- master
- release-*
env:
CONTAINER_REGISTRY: us-docker.pkg.dev/spinnaker-community/docker
jobs:
lint:
# Only run this on repositories in the 'spinnaker' org, not on forks.
if: startsWith(github.repository, 'spinnaker/')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
cache: false
- name: Ensure code formatting and style is consistent
uses: golangci/golangci-lint-action@v3
with:
version: v1.45.2
branch-build:
# Only run this on repositories in the 'spinnaker' org, not on forks.
if: startsWith(github.repository, 'spinnaker/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Prepare build variables
id: build_variables
run: |
echo REPO="${GITHUB_REPOSITORY##*/}" >> $GITHUB_OUTPUT
echo VERSION="${GITHUB_REF_NAME}-$(git rev-parse --short HEAD)-$(date --utc +'%Y%m%d%H%M')" >> $GITHUB_OUTPUT
echo VERSION_WITHOUT_BRANCH="$(git rev-parse --short HEAD)-$(date --utc +'%Y%m%d%H%M')" >> $GITHUB_OUTPUT
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
cache: false
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Fetch dependencies
run: go get -d -v
- name: Test
run: go test -v ./...
- name: Build binaries
env:
LDFLAGS: "-X github.com/spinnaker/spin/version.Version=${{ steps.build_variables.outputs.VERSION }}"
run: |
GOARCH=amd64 GOOS=darwin go build -ldflags "${LDFLAGS}" -o dist/${{ github.ref_name }}/${{ steps.build_variables.outputs.VERSION_WITHOUT_BRANCH }}/darwin/amd64/spin .
GOARCH=amd64 GOOS=linux go build -ldflags "${LDFLAGS}" -o dist/${{ github.ref_name }}/${{ steps.build_variables.outputs.VERSION_WITHOUT_BRANCH }}/linux/amd64/spin .
GOARCH=arm64 GOOS=linux go build -ldflags "${LDFLAGS}" -o dist/${{ github.ref_name }}/${{ steps.build_variables.outputs.VERSION_WITHOUT_BRANCH }}/linux/arm64/spin .
GOARCH=amd64 GOOS=windows go build -ldflags "${LDFLAGS}" -o dist/${{ github.ref_name }}/${{ steps.build_variables.outputs.VERSION_WITHOUT_BRANCH }}/windows/amd64/spin.exe .
GOARCH=arm64 GOOS=darwin go build -ldflags "${LDFLAGS}" -o dist/${{ github.ref_name }}/${{ steps.build_variables.outputs.VERSION_WITHOUT_BRANCH }}/darwin/arm64/spin .
dist/${{ github.ref_name }}/${{ steps.build_variables.outputs.VERSION_WITHOUT_BRANCH }}/linux/amd64/spin --version
- name: Login to Google Cloud
uses: 'google-github-actions/auth@v1'
# use service account flow defined at: https://github.com/google-github-actions/upload-cloud-storage#authenticating-via-service-account-key-json
with:
credentials_json: '${{ secrets.GAR_JSON_KEY }}'
- name: Upload spin CLI binaries to GCS
uses: 'google-github-actions/upload-cloud-storage@v1'
with:
path: 'dist/'
destination: 'spinnaker-artifacts/spin'
parent: false
- name: Login to GAR
# Only run this on repositories in the 'spinnaker' org, not on forks.
if: startsWith(github.repository, 'spinnaker/')
uses: docker/login-action@v2
# use service account flow defined at: https://github.com/docker/login-action#service-account-based-authentication-1
with:
registry: us-docker.pkg.dev
username: _json_key
password: ${{ secrets.GAR_JSON_KEY }}
- name: Build and publish container image
# Only run this on repositories in the 'spinnaker' org, not on forks.
if: startsWith(github.repository, 'spinnaker/')
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
push: true
build-args: |
"VERSION=${{ steps.build_variables.outputs.VERSION }}"
tags: |
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:latest"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ github.ref_name }}-latest"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}"