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

Setup tagpr #41

Merged
merged 2 commits into from
Apr 2, 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
17 changes: 17 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
changelog:
exclude:
labels:
- tagpr
categories:
- title: Breaking Changes 🛠
labels:
- breaking-change
- title: New Features 🎉
labels:
- enhancement
- title: Fix bug 🐛
labels:
- bug
- title: Other Changes
labels:
- "*"
63 changes: 63 additions & 0 deletions .github/workflows/tagpr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: tagpr
on:
push:
branches:
- main

jobs:
tagpr:
runs-on: ubuntu-latest
outputs:
tagpr-tag: ${{ steps.run-tagpr.outputs.tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check out source code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true

- id: run-tagpr
name: Run tagpr
uses: Songmu/tagpr@v1

assets:
needs: tagpr
if: needs.tagpr.outputs.tagpr-tag != ''
runs-on: macos-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check out source code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

release:
needs: [tagpr, assets]
runs-on: ubuntu-latest
steps:
- name: Release
run: |
gh api /repos/${{ github.repository }}/releases/generate-notes -f tag_name=${{ needs.tagpr.outputs.tagpr-tag }} --jq .body | gh release edit ${{ needs.tagpr.outputs.tagpr-tag }} --repo ${{ github.repository }} --draft=false --latest --notes-file=-
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.go-version
dist/
sheer-heart-attack
sheer-heart-attack-logs
*.log
coverage.txt
coverage.out
packrd
options/options-packr.go
11 changes: 4 additions & 7 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,28 @@ before:
hooks:
- go mod download
- go mod tidy
- packr2
builds:
-
id: killer-q-darwin
hooks:
pre: packr2
post: packr2 clean
env:
- CGO_ENABLED=1
- CGO_ENABLED=0
goos:
- darwin
goarch:
- amd64
- arm64
ldflags:
- -s -w -X github.com/k1LoW/sheer-heart-attack.version={{.Version}} -X github.com/k1LoW/sheer-heart-attack.commit={{.FullCommit}} -X github.com/k1LoW/sheer-heart-attack.date={{.Date}} -X github.com/k1LoW/sheer-heart-attack/version.Version={{.Version}}
-
id: killer-q-linux
hooks:
pre: packr2
post: packr2 clean
env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- amd64
- arm64
ldflags:
- -s -w -X github.com/k1LoW/sheer-heart-attack.version={{.Version}} -X github.com/k1LoW/sheer-heart-attack.commit={{.FullCommit}} -X github.com/k1LoW/sheer-heart-attack.date={{.Date}} -X github.com/k1LoW/sheer-heart-attack/version.Version={{.Version}}
archives:
Expand Down
37 changes: 37 additions & 0 deletions .tagpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# config file for the tagpr in git config format
# The tagpr generates the initial configuration, which you can rewrite to suit your environment.
# CONFIGURATIONS:
# tagpr.releaseBranch
# Generally, it is "main." It is the branch for releases. The pcpr tracks this branch,
# creates or updates a pull request as a release candidate, or tags when they are merged.
#
# tagpr.versionFile
# Versioning file containing the semantic version needed to be updated at release.
# It will be synchronized with the "git tag".
# Often this is a meta-information file such as gemspec, setup.cfg, package.json, etc.
# Sometimes the source code file, such as version.go or Bar.pm, is used.
# If you do not want to use versioning files but only git tags, specify the "-" string here.
# You can specify multiple version files by comma separated strings.
#
# tagpr.vPrefix
# Flag whether or not v-prefix is added to semver when git tagging. (e.g. v1.2.3 if true)
# This is only a tagging convention, not how it is described in the version file.
#
# tagpr.changelog (Optional)
# Flag whether or not changelog is added or changed during the release.
#
# tagpr.command (Optional)
# Command to change files just before release.
#
# tagpr.tmplate (Optional)
# Pull request template in go template format
#
# tagpr.release (Optional)
# GitHub Release creation behavior after tagging [true, draft, false]
# If this value is not set, the release is to be created.
[tagpr]
vPrefix = true
releaseBranch = main
release = draft
versionFile = version/version.go
command = "make prerelease_for_tagpr"
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,15 @@ depsdev:

prerelease:
ghch -w -N ${VER}
gocredits . > CREDITS
gocredits -w .
git add CHANGELOG.md CREDITS
git commit -m'Bump up version number'
git tag ${VER}

prerelease_for_tagpr:
gocredits -w .
git add CHANGELOG.md CREDITS go.mod go.sum

release:
goreleaser --rm-dist

Expand Down
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ package version
const Name string = "sheer-heart-attack"

// Version for this
var Version = "dev"
var Version = "3.3.1"
Loading