Skip to content
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
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: release

on:
push:
tags:
- "v*.*.*"

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0

- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
cache: true

- uses: goreleaser/goreleaser-action@ec59f474b9834571250b370d4735c50f8e2d1e29 # v7.0.0
with:
distribution: goreleaser
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18 changes: 18 additions & 0 deletions .github/workflows/tagpr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: tagpr

on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
tagpr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- uses: Songmu/tagpr@9bbb945b2fb025126186661e27d55485e3fc6df6 # v1.18.3
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
# Built CLI binary
/xp

# GoReleaser output
/dist/

# Code coverage profiles and other test artifacts
*.out
coverage.*
Expand Down
57 changes: 57 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
version: 2

project_name: xpoint-cli

before:
hooks:
- go mod tidy

builds:
- id: xp
binary: xp
main: .
env:
- CGO_ENABLED=0
flags:
- -trimpath
ldflags:
- -s -w
- -X github.com/pepabo/xpoint-cli/cmd.version={{.Version}}
- -X github.com/pepabo/xpoint-cli/cmd.commit={{.Commit}}
- -X github.com/pepabo/xpoint-cli/cmd.date={{.Date}}
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
ignore:
- goos: linux
goarch: arm64
- goos: darwin
goarch: amd64
- goos: windows
goarch: arm64

archives:
- formats: [binary]
name_template: >-
{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}

checksum:
name_template: checksums.txt

changelog:
use: github
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
- "^chore:"
- "^ci:"

release:
draft: false
prerelease: auto
7 changes: 7 additions & 0 deletions .tagpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[tagpr]
vPrefix = true
releaseBranch = main
versionFile = -
release = true
majorLabels = tagpr:major
minorLabels = tagpr:minor
7 changes: 7 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,18 @@ var (
flagAPIAccessToken string
)

var (
version = "dev"
commit = "none"
date = "unknown"
)

var rootCmd = &cobra.Command{
Use: "xp",
Short: "X-point CLI",
Long: "xp is a CLI client for X-point (https://atled-workflow.github.io/X-point-doc/api/).",
SilenceUsage: true,
Version: fmt.Sprintf("%s (commit: %s, built: %s)", version, commit, date),
}

func Execute() {
Expand Down
1 change: 0 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ github.com/itchyny/timefmt-go v0.1.8/go.mod h1:5E46Q+zj7vbTgWY8o5YkMeYb4I6GeWLFn
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=
github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=
github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY=
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
Expand Down