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 tagpar release flow #60

Merged
merged 1 commit into from
Oct 14, 2022
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
41 changes: 41 additions & 0 deletions .github/actions/release/actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: release
description: release executables

inputs:
tag:
description: check out the tag if not empty
default: ''
token:
description: GitHub token
required: true

runs:
using: composite

steps:
- uses: actions/checkout@v3
name: "checkout tag ${{ inputs.tag }}"
if: "inputs.tag != ''"
with:
ref: refs/tags/${{ inputs.tag }}
env:
GITHUB_TOKEN: ${{ inputs.token }}
- name: Set up QEMU for cross-platform image build
uses: docker/setup-qemu-action@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ~1.19
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: pfnet-research
password: ${{ inputs.token }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
version: v1.11.5
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ inputs.token }}
26 changes: 7 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
name: Release
#
# This workflow runs when tagged manually.
# It would be useful when tagpr workflow failed in some reason.
#
name: Release By Tagged Manually

on:
push:
Expand All @@ -8,23 +12,7 @@ jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v2
- uses: ./.github/actions/release
with:
go-version: ~1.19
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: pfnet-research
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
version: v1.11.5
args: release --rm-dist --debug
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
32 changes: 32 additions & 0 deletions .github/workflows/tagpr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#
# tagpr master workflow
#
name: tagpr
on:
push:
branches: ["master"]

jobs:
tagpr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: tagpr
name: Tagpr
uses: Songmu/tagpr@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# If tagpr pushed tags, invoke release custom action manually.
# It is because:
# > When you use the repository's GITHUB_TOKEN to perform tasks,
# > events triggered by the GITHUB_TOKEN, with the exception of
# > workflow_dispatch and repository_dispatch, will not create
# > a new workflow run.
# ref: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow
- name: "Release (only when tagged)"
uses: ./.github/actions/release
if: "steps.tagpr.outputs.tag != ''"
with:
tag: ${{ steps.tagpr.outputs.tag }}
token: ${{ secrets.GITHUB_TOKEN }}
36 changes: 36 additions & 0 deletions .tagpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 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 = master
versionFile = -
changelog = false
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,9 @@ $ godoc -http=:6060 # access http://localhost:6060 in browser
4. Push to the branch (`git push origin my-new-feature`)
5. Create new [Pull Request](../../pull/new/master)

## Release Procedure
## Release

1. Add a semver tag (v[0-9]+.[0-9]+.[0-9]+.) on github
2. The release workflow will start automatically
Release flow is fully automated. All the maintainer need to do is just to approve and merge [the next release PR](https://github.com/pfnet-research/git-ghost/pulls?q=is%3Apr+is%3Aopen+label%3Atagpr+)

## Copyright

Expand Down