Skip to content

Commit b0552c3

Browse files
ci: deprecate reusable actions and move to in-repo configs (#185)
1 parent 1b7fc58 commit b0552c3

7 files changed

Lines changed: 295 additions & 87 deletions

File tree

.github/renovate.json5

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"dependencyDashboardTitle": "Renovate Dashboard 🤖",
44
"extends": [
55
":dependencyDashboard",
6-
"config:best-practices",
6+
"config:recommended",
7+
"helpers:pinGitHubActionDigests",
78
":disableRateLimiting",
89
":semanticCommits",
910
"github>mirceanton/renovate-config//labels/all.json5",

.github/workflows/goreleaser.yaml

Lines changed: 43 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,52 @@ on:
1212
default: false
1313
type: boolean
1414

15-
# Dry Run on any PR that changes this pipeline or that should ultimately trigger a release when merged
16-
pull_request:
17-
paths:
18-
- ".github/workflows/goreleaser.yaml"
19-
- .goreleaser.yaml
20-
- "go.mod"
21-
- "go.sum"
22-
- "**/**.go"
23-
2415
# "Wet" Run on any tag push
2516
push:
2617
tags: ["*"]
2718

19+
# Dry Run on any PR that changes the goreleaser config or the workflow
20+
pull_request:
21+
paths:
22+
- .github/workflows/goreleaser.yaml
23+
- .goreleaser.yaml
24+
2825
jobs:
2926
goreleaser:
30-
uses: mirceanton/reusable-workflows/.github/workflows/reusable-go-release.yaml@feat/custom-images
31-
secrets: inherit
32-
with:
33-
dry-run: ${{ inputs.dry-run || github.event_name == 'pull_request' }}
34-
# renovate: depName=go datasource=golang-version
35-
go-version: 1.24.2
36-
# renovate: depName=goreleaser/goreleaser datasource=github-tags
37-
goreleaser-version: v2.8.2
27+
if: github.repository_owner == 'mirceanton' # ? don't run on forks
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Generate Token
31+
uses: actions/create-github-app-token@3ff1caaa28b64c9cc276ce0a02e2ff584f3900c5 # v2.0.2
32+
id: app-token
33+
with:
34+
app-id: "${{ secrets.BOT_APP_ID }}"
35+
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"
36+
37+
- name: Checkout
38+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
39+
with:
40+
token: "${{ steps.app-token.outputs.token }}"
41+
fetch-depth: 0
42+
43+
- name: Login to Container Registry
44+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
45+
with:
46+
registry: "ghcr.io"
47+
username: "${{ github.actor }}"
48+
password: "${{ secrets.GHCR_RW_TOKEN }}"
49+
50+
- name: Setup Go
51+
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
52+
with:
53+
go-version-file: go.mod
54+
55+
- name: Run GoReleaser
56+
uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6.3.0
57+
env:
58+
GITHUB_TOKEN: "${{ steps.app-token.outputs.token }}"
59+
TAP_GITHUB_TOKEN: "${{ secrets.GHCR_RW_TOKEN }}"
60+
with:
61+
# renovate: datasource=github-tags packageName=goreleaser/goreleaser
62+
version: v2.8.2
63+
args: ${{ (inputs.dry-run || github.event_name == 'pull_request') && '--snapshot' || '--clean' }}

.github/workflows/label-sync.yaml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,31 @@ on:
2525
- .github/workflows/label-sync.yaml
2626
- .github/configs/labels.yaml
2727

28-
# "Wet" Run daily
28+
# "Wet" Run hourly
2929
schedule:
3030
- cron: "0 * * * *"
3131

3232
jobs:
3333
label-sync:
34-
uses: mirceanton/reusable-workflows/.github/workflows/reusable-label-sync.yaml@09f31ab6340ce5651dc6c28512a82de6b2415fb9 # v3.8.2
35-
secrets: inherit
36-
with:
37-
dry-run: ${{ inputs.dry-run || github.event_name == 'pull_request' }}
38-
config-file: .github/configs/labels.yaml
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Generate Token
37+
uses: actions/create-github-app-token@3ff1caaa28b64c9cc276ce0a02e2ff584f3900c5 # v2.0.2
38+
id: app-token
39+
with:
40+
app-id: "${{ secrets.BOT_APP_ID }}"
41+
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"
42+
43+
- name: Checkout
44+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
45+
with:
46+
token: "${{ steps.app-token.outputs.token }}"
47+
sparse-checkout: "${{ env.LABEL_SYNC_CONFIG_FILE }}"
48+
49+
- name: Sync Labels
50+
uses: EndBug/label-sync@52074158190acb45f3077f9099fea818aa43f97a # v2.3.3
51+
with:
52+
dry-run: "${{ (inputs.dry-run || github.event_name == 'pull_request') == true }}"
53+
token: "${{ steps.app-token.outputs.token }}"
54+
delete-other-labels: true
55+
config-file: .github/configs/labels.yaml

.github/workflows/labeler.yaml

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,39 @@ on:
66
pull_request_target: {}
77

88
jobs:
9-
pr-labeler:
10-
uses: mirceanton/reusable-workflows/.github/workflows/reusable-labeler.yaml@09f31ab6340ce5651dc6c28512a82de6b2415fb9 # v3.8.2
11-
secrets: inherit
12-
with:
13-
config-file: .github/configs/labeler.yaml
9+
size-label:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Generate Token
13+
uses: actions/create-github-app-token@3ff1caaa28b64c9cc276ce0a02e2ff584f3900c5 # v2.0.2
14+
id: app-token
15+
with:
16+
app-id: "${{ secrets.BOT_APP_ID }}"
17+
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"
18+
19+
- name: Size Label
20+
uses: pascalgn/size-label-action@f8edde36b3be04b4f65dcfead05dc8691b374348 # v0.5.5
21+
env:
22+
GITHUB_TOKEN: "${{ steps.app-token.outputs.token }}"
23+
24+
labeler:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Generate Token
28+
uses: actions/create-github-app-token@3ff1caaa28b64c9cc276ce0a02e2ff584f3900c5 # v2.0.2
29+
id: app-token
30+
with:
31+
app-id: "${{ secrets.BOT_APP_ID }}"
32+
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"
33+
34+
- name: Checkout
35+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
36+
with:
37+
token: "${{ steps.app-token.outputs.token }}"
38+
39+
- name: Labeler
40+
uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5.0.0
41+
with:
42+
sync-labels: true
43+
repo-token: "${{ steps.app-token.outputs.token }}"
44+
configuration-path: .github/configs/labeler.yaml

.github/workflows/lint.yaml

Lines changed: 109 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,112 @@ on:
77
pull_request: {}
88

99
jobs:
10-
go:
11-
uses: mirceanton/reusable-workflows/.github/workflows/reusable-go-lint.yaml@feat/custom-images
12-
secrets: inherit
13-
with:
14-
# renovate: depName=golangci/golangci-lint datasource=github-tags
15-
version: v2.1.2
16-
17-
bash:
18-
uses: mirceanton/reusable-workflows/.github/workflows/reusable-shellcheck.yaml@09f31ab6340ce5651dc6c28512a82de6b2415fb9 # v3.8.2
19-
secrets: inherit
20-
commits:
21-
uses: mirceanton/reusable-workflows/.github/workflows/reusable-commitlint.yaml@09f31ab6340ce5651dc6c28512a82de6b2415fb9 # v3.8.2
22-
secrets: inherit
23-
with: { config-file: ./.github/configs/commitlint.config.mjs }
24-
github-actions:
25-
uses: mirceanton/reusable-workflows/.github/workflows/reusable-actionlint.yaml@09f31ab6340ce5651dc6c28512a82de6b2415fb9 # v3.8.2
26-
secrets: inherit
27-
markdown:
28-
uses: mirceanton/reusable-workflows/.github/workflows/reusable-markdownlint.yaml@09f31ab6340ce5651dc6c28512a82de6b2415fb9 # v3.8.2
29-
secrets: inherit
30-
with: { config-file: .github/configs/.markdownlint.yaml }
31-
yaml:
32-
uses: mirceanton/reusable-workflows/.github/workflows/reusable-yamllint.yaml@09f31ab6340ce5651dc6c28512a82de6b2415fb9 # v3.8.2
33-
secrets: inherit
34-
with: { config-file: .github/configs/yamllint.yaml }
10+
golangci-lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
15+
16+
- name: Get changed files
17+
id: changed-files
18+
uses: bjw-s-labs/action-changed-files@b1144fc772fca235a50902c7bb6cc431cc7d8e27 # v0.3.2
19+
with:
20+
patterns: |-
21+
.github/workflows/golangci-lint.yaml
22+
.golangci.yaml
23+
"**.go"
24+
25+
- name: Generate Token
26+
if: steps.changed-files.outputs.changed_files != '[]'
27+
uses: actions/create-github-app-token@3ff1caaa28b64c9cc276ce0a02e2ff584f3900c5 # v2.0.2
28+
id: app-token
29+
with:
30+
app-id: "${{ secrets.BOT_APP_ID }}"
31+
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"
32+
33+
- name: Setup Go
34+
if: steps.changed-files.outputs.changed_files != '[]'
35+
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
36+
with:
37+
go-version-file: go.mod
38+
39+
- name: Run golangci-lint
40+
if: steps.changed-files.outputs.changed_files != '[]'
41+
uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7.0.0
42+
with:
43+
github-token: "${{ steps.app-token.outputs.token }}"
44+
# renovate: datasource=github-tags packageName=golangci/golangci-lint
45+
version: v2.1.2
46+
47+
# ===============================================================================================
48+
# "Meta" linters
49+
# ===============================================================================================
50+
actionlint:
51+
runs-on: ubuntu-latest
52+
container: ghcr.io/mirceanton/gha-runner-actionlint:latest
53+
steps:
54+
- name: Checkout
55+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
56+
57+
- name: Get changed files
58+
id: changed-files
59+
uses: bjw-s-labs/action-changed-files@b1144fc772fca235a50902c7bb6cc431cc7d8e27 # v0.3.2
60+
with:
61+
patterns: |-
62+
.github/workflows/**/*.yml
63+
.github/workflows/**/*.yaml
64+
65+
- name: Run actionlint
66+
if: steps.changed-files.outputs.changed_files != '[]'
67+
run: actionlint
68+
69+
commitlint:
70+
runs-on: ubuntu-latest
71+
container: ghcr.io/mirceanton/gha-runner-commitlint:latest
72+
if: github.event_name == 'pull_request'
73+
steps:
74+
- name: Checkout repository
75+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
76+
77+
- name: Validate PR commits with CommitLint
78+
run: echo "$PR_TITLE" | npx commitlint --extends=./.github/configs/commitlint.config.mjs
79+
env:
80+
PR_TITLE: ${{ github.event.pull_request.title }}
81+
82+
markdownlint:
83+
runs-on: ubuntu-latest
84+
container: ghcr.io/mirceanton/gha-runner-markdownlint:latest
85+
steps:
86+
- name: Checkout repository
87+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
88+
89+
- name: Get changed files
90+
id: changed-files
91+
uses: bjw-s-labs/action-changed-files@b1144fc772fca235a50902c7bb6cc431cc7d8e27 # v0.3.2
92+
with:
93+
patterns: |-
94+
.github/configs/.markdownlint.yaml
95+
**/*.md
96+
97+
- name: Run MarkdownLint
98+
if: steps.changed-files.outputs.changed_files != '[]'
99+
run: markdownlint --config=.github/configs/.markdownlint.yaml "**/*.md"
100+
101+
yamllint:
102+
runs-on: ubuntu-latest
103+
container: ghcr.io/mirceanton/gha-runner-yamllint:latest
104+
steps:
105+
- name: Checkout
106+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
107+
108+
- name: Get changed files
109+
id: changed-files
110+
uses: bjw-s-labs/action-changed-files@b1144fc772fca235a50902c7bb6cc431cc7d8e27 # v0.3.2
111+
with:
112+
patterns: |-
113+
**/*.yml
114+
**/*.yaml
115+
116+
- name: Run yamllint
117+
if: steps.changed-files.outputs.changed_files != '[]'
118+
run: yamllint --config-file=.github/configs/yamllint.yaml .

.github/workflows/release.yaml

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,57 @@
11
---
2-
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
32
name: Release
43

54
on:
6-
# Manual Trigger
5+
# Manually trigger a new release from the Actions tab
76
workflow_dispatch:
87
inputs:
8+
version-increment:
9+
description: 'Version increment type'
10+
required: false
11+
default: 'auto'
12+
type: choice
13+
options: [ "auto", "major", "minor", "patch", "prerelease" ]
914
dry-run:
10-
description: Dry Run
15+
description: 'Dry run mode (no actual release)'
1116
required: false
1217
default: false
1318
type: boolean
19+
draft:
20+
description: Mark Release as Draft
21+
default: false
22+
required: false
23+
type: boolean
1424

15-
# Dry Run on any PR that changes this pipeline or that should ultimately trigger a release when merged
25+
# Dry run on any PR to the main branch to make sure the workflow would run
26+
# successfully before merging
1627
pull_request:
17-
paths:
18-
- ".github/workflows/git-release.yaml"
19-
- "go.mod"
20-
- "go.sum"
21-
- "**/**.go"
28+
branches: ["main"]
2229

23-
# "Wet" Run on any push to the main branch that modified a go-related file
24-
push:
25-
branches: ["main", "master"]
26-
paths:
27-
- "go.mod"
28-
- "go.sum"
29-
- "**/**.go"
30+
schedule:
31+
- cron: "0 0 * * *"
3032

3133
jobs:
32-
git:
33-
uses: mirceanton/reusable-workflows/.github/workflows/reusable-release-semver.yaml@09f31ab6340ce5651dc6c28512a82de6b2415fb9 # v3.8.2
34-
secrets: inherit
35-
with:
36-
dry-run: ${{ inputs.dry-run || github.event_name == 'pull_request' }}
37-
config-file: ./.github/configs/release.config.mjs
34+
release:
35+
if: github.repository_owner == 'mirceanton' # ? don't run on forks
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Generate Token
39+
uses: actions/create-github-app-token@3ff1caaa28b64c9cc276ce0a02e2ff584f3900c5 # v2.0.2
40+
id: app-token
41+
with:
42+
app-id: "${{ secrets.BOT_APP_ID }}"
43+
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"
44+
45+
- name: Checkout code
46+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
47+
with:
48+
token: "${{ steps.app-token.outputs.token }}"
49+
fetch-depth: 0 # !important for SVU to determine the next version number
50+
51+
- name: Create Release
52+
uses: mirceanton/action-semver-release@c48aeafa1300c3f2867ee27250f5ed076c7cb2a0 # v1.3.0
53+
with:
54+
github-token: ${{ steps.app-token.outputs.token }}
55+
version-increment: ${{ inputs.version-increment || 'auto' }}
56+
dry-run: ${{ inputs.dry-run || github.event_name == 'pull_request' }}
57+
draft: ${{ inputs.draft || 'false' }}

0 commit comments

Comments
 (0)