From adafc81d0216ab06c31b2858e6e8becfb8fe684a Mon Sep 17 00:00:00 2001 From: Callum Bodels Date: Tue, 19 Dec 2023 21:58:31 +0000 Subject: [PATCH] BUILD: WORKING COMMIT - DELETE --- .gitignore | 3 +++ .goreleaser.yaml | 16 ++++++++++++++++ ci/check-yaml-formatting.sh | 4 ++-- ci/fix-yaml-formatting.sh | 2 +- ci/release-artifacts.sh | 22 ++++++++++++++++++++++ 5 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 .goreleaser.yaml create mode 100755 ci/release-artifacts.sh diff --git a/.gitignore b/.gitignore index 8ab4af6..8810971 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,6 @@ # Generated by Go coverage. *.out + +# Generated by GoReleaser. +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..d21e2d8 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,16 @@ +# The lines below are called `modelines`. See `:help modeline` +# Feel free to remove those if you don't want/need to use them. +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj + +version: 1 + +builds: + - + main: ./cmd/starling-bank-technical-challenge + env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin diff --git a/ci/check-yaml-formatting.sh b/ci/check-yaml-formatting.sh index d39cb5a..40405f3 100755 --- a/ci/check-yaml-formatting.sh +++ b/ci/check-yaml-formatting.sh @@ -1,6 +1,6 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh set -o errexit set -o xtrace -yamlfmt -lint -dstar .github/**/* +yamlfmt -lint -dstar .github/**/* .goreleaser.yaml diff --git a/ci/fix-yaml-formatting.sh b/ci/fix-yaml-formatting.sh index 7f5c712..ab0eeb9 100755 --- a/ci/fix-yaml-formatting.sh +++ b/ci/fix-yaml-formatting.sh @@ -3,4 +3,4 @@ set -o errexit set -o xtrace -yamlfmt -dstar ./github/**/* +yamlfmt -dstar ./github/**/* .goreleaser.yaml diff --git a/ci/release-artifacts.sh b/ci/release-artifacts.sh new file mode 100755 index 0000000..05fa14b --- /dev/null +++ b/ci/release-artifacts.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env sh + +set -o errexit +set -o xtrace + +# Iterate through the array +for row in $(jq -c '.[]' "dist/artifacts.json"); do + goos=$(echo "${row}" | jq -r '.goos') + goarch=$(echo "${row}" | jq -r '.goarch') + goamd64=$(echo "${row}" | jq -r '.goamd64 // empty') + + # Append goamd64 to command_name if provided. + if [ -n "${goamd64}" ]; then + command_name="${goos}_${goarch}_${goamd64}" + else + command_name="${goos}_${goarch}" + fi + + path=$(echo "${row}" | jq -r '.path') + + echo "${command_name} ${path}" +done