Skip to content

Commit

Permalink
Merge pull request #107 from k1LoW/tagpr
Browse files Browse the repository at this point in the history
Setup tagpr
  • Loading branch information
k1LoW authored Mar 28, 2024
2 parents f022da5 + 77f8cc5 commit 94e3f5d
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 12 deletions.
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:
- "*"
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ jobs:
run: make ci

- name: Run octocov
uses: k1LoW/octocov-action@v0
uses: k1LoW/octocov-action@v1
49 changes: 45 additions & 4 deletions .github/workflows/release.yml → .github/workflows/tagpr.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,33 @@
name: release

name: tagpr
on:
pull_request:
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

ubuntu-amd64:
needs: tagpr
if: needs.tagpr.outputs.tagpr-tag != ''
name: Build packages on Ubuntu amd64
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -72,6 +95,8 @@ jobs:
dist/checksums*
ubuntu-arm64:
needs: tagpr
if: needs.tagpr.outputs.tagpr-tag != ''
name: Build packages on Ubuntu arm64
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -139,6 +164,8 @@ jobs:
dist/checksums*
centos-amd64:
needs: tagpr
if: needs.tagpr.outputs.tagpr-tag != ''
name: Build packages on CentOS amd64
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -206,6 +233,8 @@ jobs:
dist/checksums*
centos-arm64:
needs: tagpr
if: needs.tagpr.outputs.tagpr-tag != ''
name: Build packages on CentOS arm64
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -271,9 +300,10 @@ jobs:
dist/*.rpm
dist/*.tar.gz
dist/checksums*
merge:
release:
runs-on: ubuntu-latest
needs:
- tagpr
- ubuntu-amd64
- ubuntu-arm64
- centos-amd64
Expand All @@ -292,3 +322,14 @@ jobs:
path: dist/
- name: Check dist/
run: ls dist/
- name: Setup ghr
uses: k1LoW/gh-setup@v1
with:
repo: tcnksm/ghr
github-token: ${{ secrets.GITHUB_TOKEN }}
bin-match: ghr
force: true
- name: Release
run: |
ghr -t ${{ secrets.GITHUB_TOKEN }} -replace ${{ needs.tagpr.outputs.tagpr-tag }} dist/
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"
13 changes: 6 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,15 @@ build_linux: depsdev
docker-compose up $$d;\
done

prerelease:
$(eval ver = v$(shell gobump show -r version/))
ghch -w -N ${ver}

release:
$(eval ver = v$(shell gobump show -r version/))
ghr -username k1LoW -replace ${ver} dist/${ver}
prerelease_for_tagpr:
gocredits -w .
git add CHANGELOG.md CREDITS go.mod go.sum

docker:
docker build -t tcpdp_develop -f dockerfiles/Dockerfile.golang .
docker run --cap-add=SYS_PTRACE --security-opt="seccomp=unconfined" -v $(GOPATH):/go/ -v $(GOPATH)/pkg/mod/cache:/go/pkg/mod/cache -w /go/src/github.com/k1LoW/tcpdp -it tcpdp_develop /bin/bash

release:
ghr -username k1LoW -replace ${ver} dist/

.PHONY: default test

0 comments on commit 94e3f5d

Please sign in to comment.