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

Introduce tagpr #12

Merged
merged 2 commits into from
Apr 15, 2023
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
24 changes: 24 additions & 0 deletions .github/workflows/tagpr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: tagpr
on:
push:
branches:
- main
permissions: write-all
jobs:
tagpr:
runs-on: ubuntu-latest
steps:
- name: Generate Token
id: generate-token
uses: getsentry/action-github-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Check out source code
uses: actions/checkout@v3
with:
token: ${{ steps.generate-token.outputs.token }}
- name: Run tagpr
uses: Songmu/tagpr@v1
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
42 changes: 42 additions & 0 deletions .tagpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# 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 tagpr 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.template (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.majorLabels (Optional)
# Label of major update targets. Default is [major]
#
# tagpr.minorLabels (Optional)
# Label of minor update targets. Default is [minor]
#
[tagpr]
vPrefix = true
releaseBranch = main
versionFile = version/version.go
1 change: 1 addition & 0 deletions cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ This application implements algorithm is compatible with [email protected]`,
rootCmd.AddCommand(
newCompressCmd(config),
newDecompressCmd(config),
newVersionCmd(config),
)
return rootCmd
}
Expand Down
30 changes: 30 additions & 0 deletions cli/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package cli

import (
"bufio"
"errors"
"fmt"

"github.com/daku10/go-lz-string/version"
"github.com/spf13/cobra"
)

func newVersionCmd(config *Config) *cobra.Command {
var versionCmd = &cobra.Command{
Use: "version",
Short: "print version",
Long: "print the version of go-lz-string",
RunE: func(cmd *cobra.Command, args []string) error {
bufWriter := bufio.NewWriter(cmd.OutOrStdout())
fmt.Fprintln(bufWriter, version.Version)
if err := bufWriter.Flush(); err != nil {
return errors.New("version command failed")
}
return nil
},
}
versionCmd.SetIn(config.In)
versionCmd.SetOut(config.Out)
versionCmd.SetErr(config.Err)
return versionCmd
}
3 changes: 3 additions & 0 deletions version/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package version

var Version = "0.0.3"