Skip to content

Migrate to new release flow #42

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

Merged
merged 4 commits into from
Dec 17, 2024
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
57 changes: 57 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
version: v1
labels:
- label: "semver:major"
sync: true # remove label if match failed, default: false
matcher:
title: ".*BREAKING.*"

- label: "semver:minor"
sync: true # remove label if match failed, default: false
matcher:
title: "^feat(?!.*BREAKING).*"
files:
any: ["app/*"]
all: ["!app/config/**"]
count:
gte: 1
lte: 1000

- label: "semver:patch"
sync: true # remove label if match failed, default: false
matcher:
title: "^fix(?!.*BREAKING).*"

- label: "maintenance"
sync: true # remove label if match failed, default: false
matcher:
title: "^chore(?!.*BREAKING).*"
files:
any:
- "package.json"

- label: "CI/CD"
sync: true # remove label if match failed, default: false
matcher:
files:
any:
- ".github/**"

- label: "docs"
sync: true # remove label if match failed, default: false
matcher:
files:
any:
- "**/*.md"

- label: "manifest"
sync: true # remove label if match failed, default: false
matcher:
files:
any:
- "action.yml"

checks:
- context: "Ready to merge"
description: "Disable merging when 'draft' label is set."
labels:
none: ["draft"]
36 changes: 36 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name-template: "Version $RESOLVED_VERSION 🎉"
tag-template: "v$RESOLVED_VERSION"
change-template: "- (#$NUMBER) $TITLE — by @$AUTHOR 🫶"
change-title-escapes: '\<*_&'

categories:
- title: "🚀 Features"
labels:
- "semver:minor"
- title: "🐛 Bug Fixes"
labels:
- "semver:patch"
- title: "🧰 Maintenance"
labels:
- "maintenance"
- title: "👷 Build System"
labels:
- "CI/CD"
- title: "📝 Documentation Changes"
labels:
- "docs"

version-resolver:
major:
labels:
- "semver:major"
minor:
labels:
- "semver:minor"
patch:
labels:
- "semver:patch"
default: "patch"

template: |
$CHANGES
32 changes: 0 additions & 32 deletions .github/workflows/build-binary.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/master-create-release-draft.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Update release draft
on:
push:
branches:
- master

jobs:
release-draft:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write

steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.DEPLOY_APP_ID }}
private-key: ${{ secrets.DEPLOY_APP_KEY }}

- uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
name: golangci-lint
name: Lint

on:
push:
pull_request:
pull_request:

permissions:
contents: read

jobs:
golangci:
name: lint
name: Verify lint
runs-on: ubuntu-latest
strategy:
matrix:
version: [1.22, 1.23]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
go-version: ${{ matrix.version }}
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.54
version: v1.62
24 changes: 24 additions & 0 deletions .github/workflows/pull-request-relabelling.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Relabelling

on:
pull_request:

jobs:
check-labels:
name: Relabelling
runs-on: ubuntu-latest
permissions:
pull-requests: write

steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.DEPLOY_APP_ID }}
private-key: ${{ secrets.DEPLOY_APP_KEY }}

# https://github.com/fuxingloh/multi-labeler
- name: labels
uses: fuxingloh/multi-labeler@v4
with:
github-token: ${{ steps.app-token.outputs.token }}
33 changes: 0 additions & 33 deletions .github/workflows/release-binary.yml

This file was deleted.

22 changes: 22 additions & 0 deletions .github/workflows/tag-brew-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Publish Brew release

on:
push:
tags:
- "*"

jobs:
homebrew:
name: Bump Homebrew formula
runs-on: ubuntu-latest

steps:
# Documentation here
# https://github.com/mislav/bump-homebrew-formula-action?tab=readme-ov-file#action-inputs
- uses: mislav/bump-homebrew-formula-action@v3
with:
commit-message: "feat({z{formulaName}}): publish version {{version}} 🤖"
formula-path: kubernetes-labels-migrator.rb
homebrew-tap: Tchoupinax/homebrew-brew
env:
COMMITTER_TOKEN: ${{ secrets.BREW_PUBLISH_TOKEN }}
49 changes: 49 additions & 0 deletions .github/workflows/tag-goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Releases publication

on:
push:
tags:
- "*"

jobs:
goreleaser:
name: Release
runs-on: ubuntu-latest
permissions: write-all

steps:
- name: Checkout
uses: actions/checkout@v4

- id: vars
run: |
echo ::set-output name=go_version::$(cat go.mod | head -3 | tail -1 | cut -d ' ' -f 2)
echo "Using Go version ${{ steps.vars.outputs.go_version }}"

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ steps.vars.outputs.go_version }}

- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.DEPLOY_APP_ID }}
private-key: ${{ secrets.DEPLOY_APP_KEY }}

- name: Compile the source
uses: goreleaser/goreleaser-action@v6
with:
version: "~> v2"
args: "build --clean"
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: "goreleaser"
version: "~> v2"
args: "release --clean"
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
82 changes: 82 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
linters-settings:
lll:
line-length: 200
gocyclo:
min-complexity: 20
revive:
rules:
- name: dot-imports
disabled: true
#arguments:
# - allowedPackages:
# - "github.com/onsi/ginkgo"
# - "github.com/onsi/ginkgo/v2"
# - "github.com/onsi/gomega"

depguard:
rules:
prevent_unmaintained_packages:
list-mode: lax # allow unless explicitely denied
files:
- $all
- "!$test"
allow:
- $gostd
deny:
- pkg: io/ioutil
desc: "replaced by io and os packages since Go 1.16: https://tip.golang.org/doc/go1.16#ioutil"

linters:
enable:
# - funlen
# - gocritic
# - godox
# - golint
# - wsl
- bodyclose
- depguard
- dogsled
- dupl
- errcheck
- gochecknoglobals
- gochecknoinits
- gocognit
- goconst
- gocyclo
- gofmt
- goimports
- gosec
- gosimple
- govet
- ineffassign
- lll
- misspell
- nakedret
- prealloc
- revive
- staticcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- whitespace
disable:
- noctx
- errorlint

disable-all: false
presets:
- bugs
- unused
fast: false

issues:
exclude-rules:
# Exclude some linters from running on tests files.
- path: _test\.go
linters:
- gochecknoglobals
- dupl
#include:
# - EXC0002
Loading
Loading