Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inital work #1

Merged
merged 17 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# vertag Changelog
7 changes: 7 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Contributing

1. Ensure the correct version of Golang is installed. The version can be found in `./go.mod`.
1. Install the dependencies with `go install`.
1. Compile the code with `go build`.
1. Print the help text with `vertag --help`.
1. Run the tests with `go test -v ./...`.
Loading