Skip to content

Commit

Permalink
ci: add release scripts
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Collins <[email protected]>
  • Loading branch information
alexec committed Mar 13, 2023
1 parent b7f6c23 commit 1dc2963
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -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 }}
43 changes: 43 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -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: [email protected]
tap:
owner: kitproj
name: junit2html
9 changes: 9 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions release
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 1dc2963

Please sign in to comment.