Skip to content

Commit

Permalink
Merge pull request #35 from joemiller/update-deps-and-gha
Browse files Browse the repository at this point in the history
chore: update deps and bring GHA workflows up to date
  • Loading branch information
joemiller authored Nov 30, 2023
2 parents 0410c7e + 876406e commit 0b0cf39
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 832 deletions.
64 changes: 26 additions & 38 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
name: main
on: [push, pull_request]

on:
push:
branches:
- main
pull_request:
types:
- opened
- reopened
- synchronize

jobs:
test:
strategy:
matrix:
go-version: [1.17.x, 1.18.x, 1.19.x]
go-version: [1.19.x, 1.20.x, 1.21.x]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
if: github.event_name == 'push' && !contains(toJson(github.event.commits), '[ci skip]') && !contains(toJson(github.event.commits), '[skip ci]')
steps:
- uses: actions/setup-go@v2
- uses: actions/checkout@v4

- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

# TODO: switch to using the golangci-lint github action
- name: install golangci-lint
Expand All @@ -38,6 +42,7 @@ jobs:

- run: make lint
shell: bash

- run: make test
shell: bash

Expand All @@ -47,16 +52,11 @@ jobs:
if: github.ref != 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.19.x
- uses: actions/cache@v1
- uses: actions/checkout@v4

- uses: actions/setup-go@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
go-version: '1.21'

- name: Install GoReleaser
if: startsWith(runner.os, 'Linux')
Expand All @@ -72,30 +72,18 @@ jobs:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v4
with:
go-version: 1.19.x
- uses: actions/cache@v1
fetch-depth: 0
fetch-tags: true

- uses: actions/setup-go@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
go-version: '1.21'

- name: docker.io login
run: docker login docker.io -u joemiller -p ${{ secrets.DOCKERIO_TOKEN }}

- name: Unshallow
run: |
# fetch all tags and history so that goreleaser can generate a proper changelog
# and autotag can calculate the next version tag:
git fetch --tags --unshallow --prune
if [ $(git rev-parse --abbrev-ref HEAD) != "main" ]; then
# ensure a local 'main' branch exists for autotag to work correctly:
git branch --track main origin/main
fi
- name: Install GoReleaser
if: startsWith(runner.os, 'Linux')
uses: goreleaser/goreleaser-action@v2
Expand Down
30 changes: 1 addition & 29 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ builds:
# - dragonfly
# - netbsd
goarch:
- 386
- amd64
- arm
- arm64
Expand All @@ -37,8 +36,6 @@ archives:
# archive releases containing: binary, readme, and license. tarballs (macos, linux), zip (windows)
- id: archives
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
replacements:
386: i386
format_overrides:
- goos: windows
format: zip
Expand All @@ -63,7 +60,7 @@ changelog:
brews:
- ids:
- archives
tap:
repository:
owner: joemiller
name: homebrew-taps
commit_author:
Expand Down Expand Up @@ -109,28 +106,3 @@ dockers:
- "joemiller/certin:v{{ .Major }}-arm" # v1
- "joemiller/certin:v{{ .Major }}.{{ .Minor }}-arm" # v1.0
- "joemiller/certin:latest-arm"

# ## generate RPM and DEB packages
nfpms:
- id: certin
vendor: "Joe Miller"
homepage: "https://github.com/joemiller/certin"
maintainer: "certin@joemiller.me"
description: "Certin is a Go library and CLI for quickly creating keys and certificates for use as test fixtures."
license: MIT
formats:
- deb
- rpm
overrides:
rpm:
file_name_template: "{{ .ProjectName }}-{{ .Version }}-{{ .Arch }}"
replacements:
amd64: x86_64
386: i686
arm: armhfp
arm64: aarch64
deb:
file_name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
replacements:
386: i386
arm: armel
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ build:
release:
@goreleaser $(GORELEASER_ARGS)

snapshot: GORELEASER_ARGS= --rm-dist --snapshot
snapshot: GORELEASER_ARGS= --clean --snapshot
snapshot: release

todo:
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module github.com/joemiller/certin
go 1.14

require (
github.com/spf13/cobra v1.6.1
github.com/stretchr/testify v1.8.1
github.com/spf13/cobra v1.8.0
github.com/stretchr/testify v1.8.4
)
Loading

0 comments on commit 0b0cf39

Please sign in to comment.