Skip to content

Commit

Permalink
chore: prepare fork releases
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentgna committed Oct 3, 2023
1 parent 5eb2a01 commit 917c224
Show file tree
Hide file tree
Showing 7 changed files with 237 additions and 141 deletions.
32 changes: 32 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: 2
updates:
- package-ecosystem: gomod
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
labels:
- bot/merge
commit-message:
prefix: "chore: "
groups:
terraform:
patterns:
- "github.com/hashicorp/*"
gomod:
patterns:
- "*"
exclude-patterns:
- "github.com/hashicorp/*"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
labels:
- bot/merge
commit-message:
prefix: "chore: "
groups:
github-actions:
patterns:
- "*"
28 changes: 28 additions & 0 deletions .github/workflows/conventional-commits-title.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Validates PR title follows conventional commits
on:
pull_request:
types:
- edited
- opened
- synchronize
- reopened

jobs:
conventional_commit_title:
runs-on: ubuntu-22.04
steps:
# source https://github.com/chanzuckerberg/github-actions/blob/cac0ba177b109becac01bc340a3a1547feb40fe5/.github/actions/conventional-commits/action.yml
- uses: actions/github-script@v6
with:
script: |
const validator = /^(chore|feat|fix|revert|docs|style)(\(((PLAT-[0-9]+)|([a-z-]+))\))?(!)?: (.)+$/
const title = context.payload.pull_request.title
const is_valid = validator.test(title)
if (!is_valid) {
const details = JSON.stringify({
title: title,
valid_syntax: validator.toString(),
})
core.setFailed(`Your pr title doesn't adhere to conventional commits syntax. See more details: ${details}`)
}
33 changes: 33 additions & 0 deletions .github/workflows/dependabot_automerge.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# ref: https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#common-dependabot-automations
name: Dependabot auto-approve
on:
pull_request:
branches:
- master

permissions:
# required to set pr to auto merge
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
dependabot:
runs-on: ubuntu-22.04
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1
- name: Set to Auto Merge
run: |
gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{ secrets.VINCENT_PAT }}
- name: Approve PR
run: |
gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{ secrets.VINCENT_PAT }}
53 changes: 53 additions & 0 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
on:
push:
branches:
- master

name: release-please
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
id: configure-changelog
with:
result-encoding: string
script: |
const changelogTypes = [
{type: "feat", section: "Features", hidden: false},
{type: "chore", section: "Misc", hidden: false},
{type: "fix", section: "BugFixes", hidden: false},
]
return JSON.stringify(changelogTypes)
- name: release please
uses: google-github-actions/release-please-action@v3.7.12
id: release
with:
release-type: simple
bump-minor-pre-major: true
changelog-types: ${{ steps.configure-changelog.outputs.result }}
# https://github.com/google-github-actions/release-please-action#github-credentials
token: ${{ secrets.VINCENT_PAT }}

- uses: actions/checkout@v4
# we need to fetch all history and tags
# so we build the proper version
with:
fetch-depth: 0
if: ${{ steps.release.outputs.release_created }}

- uses: actions/setup-go@v4
with:
go-version-file: ".go-version"
if: ${{ steps.release.outputs.release_created }}

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.VINCENT_PAT }}
if: ${{ steps.release.outputs.release_created }}
37 changes: 0 additions & 37 deletions .github/workflows/release.yaml

This file was deleted.

15 changes: 0 additions & 15 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,3 @@ changelog:
- Merge branch
- Update README
- Update CHANGELOG
brews:
- tap:
owner: minamijoyo
name: homebrew-tfmigrate
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
commit_author:
name: "Masayuki Morita"
email: minamijoyo@gmail.com
homepage: https://github.com/minamijoyo/tfmigrate
description: "A Terraform state migration tool for GitOps"
skip_upload: auto
test: |
system "#{bin}/tfmigrate -v"
install: |
bin.install "tfmigrate"
Loading

0 comments on commit 917c224

Please sign in to comment.