-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from mdm-code/add-release
Add automatic Github release to termcols
- Loading branch information
Showing
7 changed files
with
160 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
workflow_call: | ||
inputs: | ||
args: | ||
description: 'Extra arguments to pass to goreleaser' | ||
default: '' | ||
required: false | ||
type: string | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.21' | ||
|
||
- name: Login to Github container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Release | ||
uses: goreleaser/goreleaser-action@v3 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: release ${{ inputs.args }} --clean | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
before: | ||
hooks: | ||
- go mod tidy | ||
- go fmt ./... | ||
- go test ./... | ||
|
||
builds: | ||
- id: tcols | ||
main: ./cmd/tcols | ||
binary: tcols | ||
env: | ||
- CGO_ENABLED=0 | ||
flags: | ||
- -trimpath | ||
ldflags: | ||
- -X main.version={{ .Version }} -X main.commit={{ .Commit }} -X main.date={{ .CommitDate }} | ||
mod_timestamp: '{{ .CommitTimestamp }}' | ||
targets: | ||
- linux_amd64 | ||
- linux_arm64 | ||
- linux_arm | ||
- linux_riscv64 | ||
- windows_amd64 | ||
- windows_arm64 | ||
- windows_arm | ||
- darwin_amd64 | ||
- darwin_arm64 | ||
|
||
universal_binaries: | ||
- id: tcols | ||
replace: true | ||
name_template: tcols | ||
|
||
archives: | ||
- id: tcols | ||
format: tar.gz | ||
builds: | ||
- tcols | ||
files: | ||
- none* | ||
name_template: "{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" | ||
|
||
dockers: | ||
- id: tools | ||
goos: linux | ||
goarch: amd64 | ||
ids: | ||
- tcols | ||
image_templates: | ||
- "ghcr.io/mdm-code/tcols:latest" | ||
- "ghcr.io/mdm-code/tcols:{{ .Tag }}" | ||
- "ghcr.io/mdm-code/tcols:v{{ .Major }}" | ||
skip_push: false | ||
|
||
checksum: | ||
name_template: 'sha256sums.txt' | ||
|
||
snapshot: | ||
name_template: "{{ incpatch .Version }}-next" | ||
|
||
release: | ||
github: | ||
owner: mdm-code | ||
name: tcols | ||
draft: true | ||
prerelease: auto | ||
mode: replace | ||
|
||
changelog: | ||
use: github-native | ||
|
||
announce: | ||
skip: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM scratch | ||
ENV PATH "$PATH:/bin" | ||
COPY tcols /bin/tcols |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,38 @@ | ||
GO=go | ||
GOFLAGS=-race | ||
DEV_BIN=bin | ||
COV_PROFILE=cp.out | ||
GOFLAGS= | ||
COV_PROFILE=coverage.txt | ||
|
||
export CGO_ENABLED = 1 | ||
export CGO_ENABLED=0 | ||
|
||
.DEFAULT_GOAL := build | ||
|
||
.PHONY: fmt vet lint test install build cover clean | ||
|
||
fmt: | ||
$(GO) fmt ./... | ||
.PHONY: fmt | ||
@$(GO) fmt ./... | ||
|
||
vet: fmt | ||
$(GO) vet ./... | ||
.PHONY: vet | ||
@$(GO) vet ./... | ||
|
||
lint: vet | ||
golint -set_exit_status=1 ./... | ||
.PHONY: lint | ||
@golint -set_exit_status=1 ./... | ||
|
||
test: lint | ||
$(GO) clean -testcache | ||
$(GO) test ./... -v | ||
.PHONY: test | ||
@$(GO) clean -testcache | ||
@$(GO) test ./... -v | ||
|
||
install: test | ||
$(GO) install ./... | ||
.PHONY: install | ||
@$(GO) install ./... | ||
|
||
build: test | ||
$(GO) build $(GOFLAGS) github.com/mdm-code/termcols/... | ||
.PHONY: build | ||
@$(GO) build $(GOFLAGS) github.com/mdm-code/termcols/... | ||
|
||
cover: | ||
$(GO) test -coverprofile=$(COV_PROFILE) -covermode=atomic ./... | ||
$(GO) tool cover -html=$(COV_PROFILE) | ||
.PHONY: cover | ||
@$(GO) test -coverprofile=$(COV_PROFILE) -covermode=atomic ./... | ||
@$(GO) tool cover -html=$(COV_PROFILE) | ||
|
||
clean: | ||
$(GO) clean github.com/mdm-code/termcols/... | ||
$(GO) mod tidy | ||
$(GO) clean -testcache | ||
rm -f $(COV_PROFILE) | ||
.PHONY: clean | ||
@$(GO) clean github.com/mdm-code/termcols/... | ||
@$(GO) mod tidy | ||
@$(GO) clean -testcache | ||
@rm -f $(COV_PROFILE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters