Skip to content

Commit

Permalink
update reusable workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
mircea-pavel-anton committed Sep 6, 2024
1 parent 10c72de commit aa9fdc5
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 227 deletions.
52 changes: 20 additions & 32 deletions .github/workflows/git-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,22 @@
name: Git Release

on:
workflow_dispatch: {}
workflow_dispatch:
inputs:
dry-run:
description: "Dry run"
required: false
default: false
type: boolean

pull_request:
paths:
- ".github/workflows/git-release.yaml"
- "cmd/**"
- "go.mod"
- "go.sum"
- "main.go"

push:
branches: ["main"]
paths:
Expand All @@ -14,34 +29,7 @@ on:

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Generate Token
uses: actions/create-github-app-token@3378cda945da322a8db4b193e19d46352ebe2de5 # v1.10.4
id: app-token
with:
app-id: "${{ secrets.BOT_APP_ID }}"
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"

- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
token: "${{ steps.app-token.outputs.token }}"

- name: Set up Node.js
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
with:
node-version: "22"

- name: Install dependencies
run: npm install semantic-release @semantic-release/github

- name: Run semantic-release
run: |
npx semantic-release \
--branches=main \
--plugins=@semantic-release/commit-analyzer \
--plugins=@semantic-release/release-notes-generator \
--plugins=@semantic-release/github
env:
GITHUB_TOKEN: "${{ steps.app-token.outputs.token }}"
uses: mirceanton/reusable-workflows/.github/workflows/git-release-semver.yaml@main@779974ececd8243d133c1813f429e3415712456b
secrets: inherit
with:
dry-run: ${{ github.event.inputs.dry-run || github.event.name == 'pull_request' }}
22 changes: 22 additions & 0 deletions .github/workflows/go-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Go Lint

on:
workflow_dispatch: {}

pull_request:
paths:
- ".github/workflows/go-lint.yaml"
- ".golangci.yaml"
- "go.mod"
- "go.sum"
- "cmd/**"

jobs:
golangci-lint:
uses: mirceanton/reusable-workflows/.github/workflows/go-lint.yaml@main@779974ececd8243d133c1813f429e3415712456b
secrets: inherit
with:
go-version: "1.22.5"
golangci-version: "v1.60.3"
29 changes: 29 additions & 0 deletions .github/workflows/go-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Go Release

on:
workflow_dispatch: {}

push:
tags: ["*"]

pull_request:
paths:
- ".github/workflows/go-release.yaml"
- ".goreleaser.yaml"
- "go.mod"
- "go.sum"
- "cmd/**"

jobs:
goreleaser:
uses: mirceanton/reusable-workflows/.github/workflows/go-release.yaml@main@779974ececd8243d133c1813f429e3415712456b
secrets: inherit
with:
go-version: "1.22.5"
goreleaser-version: "v2.2.0"
dry-run: ${{ github.event.inputs.dry-run || github.event_name == 'pull_request' }}
registry-url: "ghcr.io"
registry-username: ${{ github.actor }}
registry-password: ${{ secrets.GHCR_RW_TOKEN }}
41 changes: 0 additions & 41 deletions .github/workflows/golangci-lint.yaml

This file was deleted.

55 changes: 0 additions & 55 deletions .github/workflows/goreleaser.yaml

This file was deleted.

39 changes: 8 additions & 31 deletions .github/workflows/meta-label-sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,48 +10,25 @@ on:
default: true
required: false
type: boolean

pull_request:
paths:
- ".github/configs/labels.yaml"
- ".github/workflows/meta-label-sync.yaml"

push:
branches: ["main"]
paths:
- ".github/configs/labels.yaml"
- ".github/workflows/meta-label-sync.yaml"

schedule:
- cron: "0 0 * * *" # Every day at midnight

permissions:
issues: write

env:
CONFIG_PATH: ".github/configs/labels.yaml"
DELETE_OTHER_LABELS: true
DRY_RUN: ${{ github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && github.event.inputs.dry-run == 'true') }}

jobs:
label-sync:
runs-on: ubuntu-latest

steps:
- name: Generate Token
uses: actions/create-github-app-token@3378cda945da322a8db4b193e19d46352ebe2de5 # v1.10.4
id: app-token
with:
app-id: "${{ secrets.BOT_APP_ID }}"
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"

- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
token: "${{ steps.app-token.outputs.token }}"
sparse-checkout: "${{ env.CONFIG_PATH }}"

- name: Sync Labels
uses: EndBug/label-sync@52074158190acb45f3077f9099fea818aa43f97a # v2.3.3
with:
token: "${{ steps.app-token.outputs.token }}"
config-file: "${{ env.CONFIG_PATH }}"
delete-other-labels: "${{ env.DELETE_OTHER_LABELS }}"
dry-run: "${{ env.DRY_RUN }}"
uses: mirceanton/reusable-workflows/.github/workflows/meta-label-sync.yaml@main@779974ececd8243d133c1813f429e3415712456b
secrets: inherit
with:
dry-run: ${{ github.event.inputs.dry-run || github.event_name == 'pull_request' }}
config-file: ".github/configs/labels.yaml"
41 changes: 5 additions & 36 deletions .github/workflows/meta-labeler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,8 @@ on:
pull_request_target: {}

jobs:
size-label:
runs-on: ubuntu-latest
steps:
- name: Generate Token
uses: actions/create-github-app-token@3378cda945da322a8db4b193e19d46352ebe2de5 # v1.10.4
id: app-token
with:
app-id: "${{ secrets.BOT_APP_ID }}"
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"

- name: Size Label
uses: pascalgn/size-label-action@be08a2d5f857dc99c5b9426cdb5a8ea1aa7f0399 # v0.5.4
env:
GITHUB_TOKEN: "${{ steps.app-token.outputs.token }}"

labeler:
runs-on: ubuntu-latest
steps:
- name: Generate Token
uses: actions/create-github-app-token@3378cda945da322a8db4b193e19d46352ebe2de5 # v1.10.4
id: app-token
with:
app-id: "${{ secrets.BOT_APP_ID }}"
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"

- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
token: "${{ steps.app-token.outputs.token }}"

- name: Labeler
uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5.0.0
with:
configuration-path: ".github/configs/labeler.yaml"
repo-token: "${{ steps.app-token.outputs.token }}"
sync-labels: true
pr-labeler:
uses: mirceanton/reusable-workflows/.github/workflows/go-release.yaml@main@779974ececd8243d133c1813f429e3415712456b
secrets: inherit
with:
config-file: ".github/configs/labeler.yaml"
39 changes: 7 additions & 32 deletions .github/workflows/renovate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ name: Renovate
on:
workflow_dispatch:
inputs:
dryRun:
dry-run:
description: Dry Run
default: "false"
required: false
logLevel:
log-level:
description: Log Level
default: debug
required: false
Expand All @@ -20,35 +20,10 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true

env:
LOG_LEVEL: "${{ inputs.logLevel || 'debug' }}"
RENOVATE_AUTODISCOVER: true
RENOVATE_AUTODISCOVER_FILTER: "${{ github.repository }}"
RENOVATE_DRY_RUN: "${{ inputs.dryRun == true }}"
RENOVATE_PLATFORM: github
RENOVATE_PLATFORM_COMMIT: true
RENOVATE_VERSION: 37.367.0
RENOVATE_GIT_AUTHOR: "mr-borboto[bot] <170036086+mr-borboto[bot]@users.noreply.github.com>"

jobs:
renovate:
runs-on: "ubuntu-latest"
steps:
- name: Generate Token
uses: actions/create-github-app-token@3378cda945da322a8db4b193e19d46352ebe2de5 # v1.10.4
id: app-token
with:
app-id: "${{ secrets.BOT_APP_ID }}"
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"

- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
token: "${{ steps.app-token.outputs.token }}"

- name: Renovate
uses: renovatebot/github-action@630a255a1f2f56c8d8ce160bed3e3ca577ca53e2 # v40.2.7
with:
token: "${{ steps.app-token.outputs.token }}"
configurationFile: .github/renovate.json5
renovate-version: "${{ env.WORKFLOW_RENOVATE_VERSION }}"
uses: mirceanton/reusable-workflows/.github/workflows/renovate.yaml@main
secrets: inherit
with:
dryRun: "${{ inputs.dry-run == true }}"
logLevel: "${{ inputs.log-level || 'debug' }}"

0 comments on commit aa9fdc5

Please sign in to comment.