From 1dc29639d682f8d603449a5bcc45fa0f724adc52 Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Mon, 13 Mar 2023 07:22:06 -0700 Subject: [PATCH] ci: add release scripts Signed-off-by: Alex Collins --- .github/workflows/goreleaser.yml | 37 +++++++++++++++++++++++++++ .goreleaser.yaml | 43 ++++++++++++++++++++++++++++++++ install.sh | 9 +++++++ release | 7 ++++++ 4 files changed, 96 insertions(+) create mode 100644 .github/workflows/goreleaser.yml create mode 100644 .goreleaser.yaml create mode 100755 install.sh create mode 100755 release diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml new file mode 100644 index 0000000..275e965 --- /dev/null +++ b/.github/workflows/goreleaser.yml @@ -0,0 +1,37 @@ +name: goreleaser + +on: + push: + # run only against tags + tags: + - "*" + +permissions: + contents: write + # packages: write + # issues: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - run: git fetch --force --tags + - uses: actions/setup-go@v3 + with: + go-version: ">=1.19.1" + cache: true + # More assembly might be required: Docker logins, GPG, etc. It all depends + # on your needs. + - uses: goreleaser/goreleaser-action@v2 + with: + # either 'goreleaser' (default) or 'goreleaser-pro' + distribution: goreleaser + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution + # GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..511ad74 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,43 @@ +# This is an example .goreleaser.yml file with some sensible defaults. +# Make sure to check the documentation at https://goreleaser.com +before: + hooks: + # You may remove this if you don't use go modules. + - go mod tidy + # you may remove this if you don't need go generate + - go generate ./... +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - darwin +archives: + - replacements: + darwin: Darwin + linux: Linux + 386: i386 + amd64: x86_64 +checksum: + name_template: "checksums.txt" +snapshot: + name_template: "{{ incpatch .Version }}-next" +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:" +# modelines, feel free to remove those if you don't want/use them: +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj +brews: + - homepage: "https://github.com/kitproj/junit2html" + description: "Crazy fast local dev loop." + folder: Formula + commit_author: + name: Alex Collins + email: alex_collins@intuit.com + tap: + owner: kitproj + name: junit2html diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..3098d5f --- /dev/null +++ b/install.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env sh +set -eux + +tag=$(curl --retry 3 -s "https://api.github.com/repos/kitproj/junit2html/releases/latest" | jq -r '.tag_name') +version=$(echo $tag | cut -c 2-) +url="https://github.com/kitproj/junit2html/releases/download/${tag}/kit_${version}_$(uname)_$(uname -m | sed 's/aarch64/arm64/').tar.gz" +curl --retry 3 -L $url | tar -zxvf - junit2html +chmod +x junit2html +sudo mv junit2html /usr/local/bin/junit2html diff --git a/release b/release new file mode 100755 index 0000000..7a37325 --- /dev/null +++ b/release @@ -0,0 +1,7 @@ +#!/bin/sh + +go install github.com/ffurrer2/semver/v2/cmd/semver@latest + +git tag v$(semver next patch $(git tag|sort -V|tail -n1|cut -c 2-)) + +git push --tags \ No newline at end of file