Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshowe committed Jan 29, 2024
0 parents commit 3fb1343
Show file tree
Hide file tree
Showing 7 changed files with 196 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
indent_size = 2
indent_style = space
insert_final_newline = true
tab_width = 4
trim_trailing_whitespace = true

[*.go]
indent_style = tab

[Makefile]
indent_style = tab
17 changes: 17 additions & 0 deletions .github/delete-prereleases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Delete pre-releases

on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: dev-drprasad/[email protected]
with:
delete_prerelease_only: true
delete_tags: true
keep_latest: 0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
name: CI

on:
push:
branches:
- "**"
pull_request:
branches:
- "**"
workflow_dispatch:

jobs:
preflight:
runs-on: ubuntu-latest
outputs:
go_version: ${{ steps.get_go_version.outputs.go_version }}
steps:
- uses: actions/checkout@v3

- id: get_go_version
name: Get Golang version
run: |
set -euo pipefail
go_version=$(sed -n 3p ${GITHUB_WORKSPACE}/go.mod | cut -d " " -f2)
echo "Golang version: ${go_version}"
echo "go_version=$go_version" >> "$GITHUB_OUTPUT"
build:
needs: preflight
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ needs.preflight.outputs.go_version }}

- name: Build
run: make build

- name: Test
run: make test
17 changes: 17 additions & 0 deletions .github/workflows/delete-prereleases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Delete pre-releases

on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: dev-drprasad/[email protected]
with:
delete_prerelease_only: true
delete_tags: true
keep_latest: 0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release

on:
push:
tags:
- "**"

permissions:
contents: write

jobs:
preflight:
runs-on: ubuntu-latest
outputs:
go_version: ${{ steps.get_go_version.outputs.go_version }}
steps:
- uses: actions/checkout@v3

- id: get_go_version
name: Get Golang version
run: |
set -euo pipefail
go_version=$(sed -n 3p ${GITHUB_WORKSPACE}/go.mod | cut -d " " -f2)
echo "Golang version: ${go_version}"
echo "go_version=$go_version" >> "$GITHUB_OUTPUT"
release:
needs: preflight
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- run: git fetch --force --tags

- uses: actions/setup-go@v4
with:
go-version: ${{ needs.preflight.outputs.go_version }}

- uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# ide
.env
.vscode

# go
/vertag

# other
dist/
45 changes: 45 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# 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:
- main: ./cmd/vertag/vertag.go
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin

archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of uname.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
# use zip for windows archives
format_overrides:
- goos: windows
format: zip
checksum:
name_template: "checksums.txt"
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
# The lines beneath this are called `modelines`. See `:help modeline`
# 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

0 comments on commit 3fb1343

Please sign in to comment.