-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
83c433b
commit 210fb51
Showing
20 changed files
with
1,129 additions
and
48 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 @@ | ||
* @kvanzuijlen |
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,48 @@ | ||
name-template: "v$RESOLVED_VERSION 🌈" | ||
tag-template: "v$RESOLVED_VERSION" | ||
categories: | ||
- title: "🚀 Features" | ||
labels: | ||
- "kind:feature" | ||
- "kind:enhancement" | ||
- title: "🐛 Bug Fixes" | ||
label: "kind:fix" | ||
- title: "🧰 Maintenance" | ||
label: "kind:chore" | ||
- title: "⬆️ Dependencies" | ||
label: "kind:dependencies" | ||
change-template: "- $TITLE @$AUTHOR (#$NUMBER)" | ||
change-title-escapes: '\<*_&' | ||
exclude-labels: | ||
- "semver:none" | ||
version-resolver: | ||
major: | ||
labels: | ||
- "semver:major" | ||
minor: | ||
labels: | ||
- "semver:minor" | ||
patch: | ||
labels: | ||
- "semver:patch" | ||
default: patch | ||
template: | | ||
## Changes | ||
$CHANGES | ||
autolabeler: | ||
- label: "kind:chore" | ||
title: | ||
- "/chore/i" | ||
- label: "kind:fix" | ||
title: | ||
- "/fix/i" | ||
- label: "kind:dependencies" | ||
title: | ||
- "/dependencies/i" | ||
- label: "kind:enhancement" | ||
title: | ||
- "/enhancement/i" | ||
- label: "kind:feature" | ||
title: | ||
- "/feature/i" |
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,22 @@ | ||
{ | ||
$schema: "https://docs.renovatebot.com/renovate-schema.json", | ||
semanticCommits: "auto", | ||
dependencyDashboard: true, | ||
enabledManagers: ["dockerfile", "gomod", "github-actions", "regex"], | ||
customManagers: [ | ||
{ | ||
customType: "regex", | ||
fileMatch: "^Dockerfile", | ||
matchStrings: ['ARG BASE_IMAGE_DIGEST="(?<currentDigest>.*)"'], | ||
depNameTemplate: "gcr.io/distroless/static", | ||
currentValueTemplate: "nonroot", | ||
datasourceTemplate: "docker", | ||
}, | ||
], | ||
packageRules: [ | ||
{ | ||
matchDepNames: "gcr.io/distroless/static", | ||
group: true, | ||
}, | ||
], | ||
} |
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,20 @@ | ||
name: Docker Build | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
name: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 | ||
|
||
- name: Build Docker image | ||
run: make docker-build |
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,31 @@ | ||
name: "Check Merge-able by label ✅" | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
- edited | ||
- labeled | ||
- unlabeled | ||
|
||
jobs: | ||
fail-by-label: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Fail if PR is labeled "do-not-merge" | ||
if: contains(github.event.pull_request.labels.*.name, 'do-not-merge') | ||
run: | | ||
echo "This PR is labeled as do-not-merge!" | ||
exit 1 | ||
- name: Fail if PR doesn't have SemVer label | ||
if: "!contains(github.event.pull_request.labels.*.name, 'semver:major') && !contains(github.event.pull_request.labels.*.name, 'semver:minor') && !contains(github.event.pull_request.labels.*.name, 'semver:patch') && !contains(github.event.pull_request.labels.*.name, 'semver:none')" | ||
run: | | ||
echo "Every PR needs a semver label!" | ||
exit 1 | ||
- name: Fail if PR doesn't have kind label | ||
if: "!contains(github.event.pull_request.labels.*.name, 'kind:feature') && !contains(github.event.pull_request.labels.*.name, 'kind:enhancement') && !contains(github.event.pull_request.labels.*.name, 'kind:fix') && !contains(github.event.pull_request.labels.*.name, 'kind:bugfix') && !contains(github.event.pull_request.labels.*.name, 'kind:chore') && !contains(github.event.pull_request.labels.*.name, 'kind:dependencies')" | ||
run: | | ||
echo "Every PR needs a kind label!" | ||
exit 1 |
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,19 @@ | ||
name: PR labeler | ||
|
||
on: | ||
pull_request_target: | ||
types: [opened, reopened, synchronize] | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: write | ||
|
||
jobs: | ||
triage: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: release-drafter/release-drafter@09c613e259eb8d4e7c81c2cb00618eb5fc4575a7 # v5.25.0 | ||
with: | ||
disable-releaser: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,31 @@ | ||
name: Prettier | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
prettier: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
with: | ||
ref: ${{ github.head_ref }} # so PRs resolve to correct branch | ||
fetch-depth: 0 # needed for only_changed below | ||
persist-credentials: false | ||
- name: Create GitHub App Token | ||
id: app-token | ||
uses: actions/create-github-app-token@86576b355dd19da0519e0bdb63d8edb5bcf76a25 # v1.6.0 | ||
with: | ||
app-id: ${{ secrets.VERSION_CLI_UPDATER_APP_ID }} | ||
private-key: ${{ secrets.VERSION_CLI_UPDATER_PRIVATE_KEY }} | ||
- name: Prettify code | ||
uses: creyD/prettier_action@31355f8eef017f8aeba2e0bc09d8502b13dbbad1 # v4.3 | ||
with: | ||
commit_message: "Prettier" | ||
only_changed: True | ||
github_token: ${{ steps.app-token.outputs.token }} | ||
prettier_options: --write . # the `.` targets all files which prettier _can_ parse, and ignores all others |
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,85 @@ | ||
name: Create release | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
release: | ||
permissions: | ||
contents: "write" | ||
id-token: "write" | ||
packages: "write" | ||
pull-requests: "read" | ||
name: release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout action code | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Draft release | ||
id: draft_release | ||
uses: release-drafter/release-drafter@3f0f87098bd6b5c5b9a36d49c41d998ea58f9348 # v6.0.0 | ||
with: | ||
disable-autolabeler: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build Docker image | ||
run: VERSION=${{ steps.draft_release.outputs.tag_name }} make docker-push | ||
|
||
- name: Publish release | ||
uses: release-drafter/release-drafter@3f0f87098bd6b5c5b9a36d49c41d998ea58f9348 # v6.0.0 | ||
if: steps.draft_release.outputs.tag_name != '' | ||
with: | ||
version: ${{ steps.draft_release.outputs.tag_name }} | ||
publish: true | ||
disable-autolabeler: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create GitHub App Token | ||
id: app-token | ||
uses: actions/create-github-app-token@86576b355dd19da0519e0bdb63d8edb5bcf76a25 # v1.6.0 | ||
with: | ||
app-id: ${{ secrets.VERSION_CLI_UPDATER_APP_ID }} | ||
private-key: ${{ secrets.VERSION_CLI_UPDATER_PRIVATE_KEY }} | ||
|
||
- name: Checkout action code | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ steps.draft_release.outputs.tag_name }} | ||
|
||
- name: Setup Go environment | ||
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | ||
with: | ||
go-version-file: "go.mod" | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v2.0.0 | ||
with: | ||
version: latest | ||
args: release --skip=publish --clean | ||
env: | ||
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | ||
GORELEASER_CURRENT_TAG: ${{ steps.draft_release.outputs.tag_name }} | ||
|
||
- name: Upload files | ||
run: | | ||
gh release upload --clobber ${{ env.VERSION }} ${{ env.FILES }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
VERSION: ${{ steps.draft_release.outputs.tag_name }} | ||
FILES: dist/version_*.tar.gz dist/version_*.zip dist/version_*_checksums.txt |
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 +1,3 @@ | ||
.idea/ | ||
|
||
dist/ |
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,70 @@ | ||
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json | ||
version: 1 | ||
|
||
project_name: version | ||
|
||
before: | ||
hooks: | ||
- go mod tidy | ||
- go generate | ||
|
||
builds: | ||
- env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- windows | ||
- darwin | ||
- freebsd | ||
goarch: | ||
- arm64 | ||
- amd64 | ||
- arm | ||
- "386" | ||
goarm: | ||
- "6" | ||
- "7" | ||
ldflags: | ||
- -s -w -X "github.com/kvanzuijlen/version/cmd.VERSION={{.Version}}" | ||
|
||
checksum: | ||
disable: false | ||
|
||
archives: | ||
- format: tar.gz | ||
# this name template makes the OS and Arch compatible with the results of `uname`. | ||
name_template: >- | ||
{{ .ProjectName }}_ | ||
{{- title .Os }}_ | ||
{{- if eq .Arch "amd64" }}x86_64 | ||
{{- else if eq .Arch "386" }}i386 | ||
{{- else }}{{ .Arch }}{{ end }} | ||
{{- if .Arm }}v{{ .Arm }}{{ end }} | ||
# use zip for windows archives | ||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
|
||
universal_binaries: | ||
- {} | ||
|
||
changelog: | ||
skip: true | ||
|
||
brews: | ||
- repository: | ||
owner: kvanzuijlen | ||
name: homebrew-version | ||
name: version | ||
homepage: "https://github.com/kvanzuijlen/version" | ||
description: "CLI tool to deal with versions" | ||
license: "GNU GPLv3" | ||
skip_upload: auto | ||
commit_author: | ||
name: version | ||
email: [email protected] | ||
folder: Formula | ||
install: |- | ||
bin.install "version" | ||
test: | | ||
system "#{bin}/version -v" |
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,54 @@ | ||
FROM --platform=${BUILDPLATFORM} golang:1.21-bookworm@sha256:135ba6c2ae2a9a022f53f3eee24ef213bc62e876811cd9582b91045168206873 AS builder | ||
|
||
WORKDIR /src/ | ||
|
||
COPY . . | ||
|
||
ARG VERSION | ||
|
||
RUN case ${TARGETPLATFORM} in \ | ||
"linux/amd64") GOARCH=amd64 ;; \ | ||
# arm64 and arm64v8 are equivilant in go and do not require a goarm | ||
# https://github.com/golang/go/wiki/GoArm | ||
"linux/arm64" | "linux/arm/v8") GOARCH=arm64 ;; \ | ||
"linux/ppc64le") GOARCH=ppc64le ;; \ | ||
"linux/arm/v6") GOARCH=arm GOARM=6 ;; \ | ||
"linux/arm/v7") GOARCH=arm GOARM=7 ;; \ | ||
esac && \ | ||
GOARCH=${GOARCH} VERSION=${VERSION} make build | ||
|
||
FROM gcr.io/distroless/static:nonroot@sha256:112a87f19e83c83711cc81ce8ed0b4d79acd65789682a6a272df57c4a0858534 | ||
|
||
COPY --from=builder /src/version /bin/version | ||
|
||
ARG CREATED | ||
ARG AUTHORS="Koen van Zuijlen <[email protected]>" | ||
ARG URL="https://github.com/kvanzuijlen/version" | ||
ARG DOCUMENTATION="https://github.com/kvanzuijlen/version" | ||
ARG SOURCE="https://github.com/kvanzuijlen/version" | ||
ARG VERSION | ||
ARG REVISION | ||
ARG VENDOR="kvanzuijlen" | ||
ARG LICENSES="GNU GPLv3" | ||
ARG TITLE="version" | ||
ARG DESCRIPTION="A simple CLI tool to deal with version numbers." | ||
ARG BASE_IMAGE="gcr.io/distroless/static:nonroot" | ||
ARG BASE_IMAGE_DIGEST="sha256:112a87f19e83c83711cc81ce8ed0b4d79acd65789682a6a272df57c4a0858534" | ||
|
||
LABEL authors="kvanzuijlen" \ | ||
org.opencontainers.image.created=${CREATED} \ | ||
org.opencontainers.image.authors=${AUTHORS} \ | ||
org.opencontainers.image.url=${URL} \ | ||
org.opencontainers.image.documentation=${DOCUMENTATION} \ | ||
org.opencontainers.image.source=${SOURCE} \ | ||
org.opencontainers.image.version=${VERSION} \ | ||
org.opencontainers.image.revision=${REVISION} \ | ||
org.opencontainers.image.vendor=${VENDOR} \ | ||
org.opencontainers.image.licenses=${LICENSES} \ | ||
org.opencontainers.image.ref.name=v${VERSION} \ | ||
org.opencontainers.image.title=${TITLE} \ | ||
org.opencontainers.image.description=${DESCRIPTION} \ | ||
org.opencontainers.image.base.digest=${BASE_IMAGE_DIGEST} \ | ||
org.opencontainers.image.base.name=${BASE_IMAGE} | ||
|
||
ENTRYPOINT ["/bin/version"] |
Oops, something went wrong.