-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from k1LoW/tagpr
Setup tagpr
- Loading branch information
Showing
7 changed files
with
166 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
changelog: | ||
exclude: | ||
labels: | ||
- tagpr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
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@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: go.mod | ||
cache: true | ||
|
||
- id: run-tagpr | ||
name: Run tagpr | ||
uses: Songmu/tagpr@v1 | ||
|
||
release: | ||
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@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: go.mod | ||
cache: true | ||
|
||
- name: Setup goreleaser | ||
run: | | ||
brew install goreleaser | ||
- name: Release | ||
run: | | ||
make release | ||
dockerimage: | ||
needs: tagpr | ||
if: needs.tagpr.outputs.tagpr-tag != '' | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- name: Check out source code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Get latest version | ||
id: latest_version | ||
run: | | ||
echo -n 'version=' > $GITHUB_OUTPUT | ||
gh release list --limit 1 | cut -f 1 >> $GITHUB_OUTPUT | ||
cat $GITHUB_OUTPUT | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to ghcr.io | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: Dockerfile | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: | | ||
ghcr.io/k1low/gh-grep:${{ steps.latest_version.outputs.version }} | ||
ghcr.io/k1low/gh-grep:latest | ||
labels: | | ||
org.opencontainers.image.name=gh-grep | ||
org.opencontainers.image.revision=${{ github.sha }} | ||
org.opencontainers.image.version=${{ steps.latest_version.outputs.version }} | ||
org.opencontainers.image.source=https://github.com/k1LoW/gh-grep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = main | ||
versionFile = version/version.go | ||
command = "make prerelease_for_tagpr" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,24 @@ | ||
FROM debian:buster-slim | ||
FROM golang:1-bullseye AS builder | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
curl \ | ||
git \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
WORKDIR /workdir/ | ||
COPY . /workdir/ | ||
|
||
RUN apt-get update | ||
|
||
RUN update-ca-certificates | ||
|
||
RUN make build | ||
|
||
FROM debian:bullseye-slim | ||
|
||
RUN apt-get update \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
COPY --from=builder /workdir/ghgrep ./usr/bin/gh-grep | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] | ||
|
||
COPY scripts/entrypoint.sh /entrypoint.sh | ||
RUN chmod +x /entrypoint.sh | ||
|
||
COPY gh-grep_*.deb /tmp/ | ||
RUN dpkg -i /tmp/gh-grep_*.deb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ package version | |
const Name string = "gh-grep" | ||
|
||
// Version for this | ||
var Version = "dev" | ||
var Version = "1.1.0" |