Skip to content

Commit c2a818d

Browse files
authored
Merge pull request #203 from LerianStudio/develop
fix(release): merge develop into main
2 parents 34df442 + 49c0216 commit c2a818d

15 files changed

Lines changed: 64 additions & 47 deletions

.cursor/rules/reusable-workflows.mdc

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ runs-on: self-hosted
127127

128128
Every reusable workflow must:
129129
- support `workflow_call` (for external callers)
130-
- support `workflow_dispatch` (for manual testing)
131130
- expose explicit `inputs` — never rely on implicit context
131+
- **must NOT** include a `workflow_dispatch` trigger — if manual/interactive dispatch is needed, create a separate self-workflow under `.github/workflows/self-*`
132132
- **always include a `dry_run` input** (`type: boolean`, `default: false`) so the workflow can be safely tested before applying real changes
133133

134134
```yaml
@@ -146,15 +146,6 @@ on:
146146
secrets:
147147
DEPLOY_TOKEN:
148148
required: true
149-
workflow_dispatch:
150-
inputs:
151-
environment:
152-
required: true
153-
type: string
154-
dry_run:
155-
description: Preview changes without applying them
156-
type: boolean
157-
default: false
158149
```
159150

160151
The two modes have opposite goals — design them accordingly:

.github/workflows/build.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ on:
123123
type: boolean
124124
default: false
125125
docker_build_args:
126-
description: 'Newline-separated Docker build arguments to pass to docker build (e.g., "APP_NAME=spi\nCOMPONENT_NAME=api"). Forwarded to docker/build-push-action build-args.'
126+
description: 'Newline-separated Docker build arguments (e.g., "APP_NAME=spi\nCOMPONENT_NAME=api"). For sensitive values (tokens, keys, passwords), use BuildKit secrets instead — build arguments are visible in image history.'
127127
type: string
128128
required: false
129129
default: ''
@@ -139,7 +139,6 @@ on:
139139
permissions:
140140
contents: read
141141
packages: write
142-
id-token: write
143142

144143
jobs:
145144
prepare:
@@ -208,6 +207,10 @@ jobs:
208207
if: needs.prepare.outputs.has_builds == 'true'
209208
runs-on: ${{ inputs.runner_type }}
210209
name: Build ${{ matrix.app.name }}
210+
permissions:
211+
contents: read
212+
packages: write
213+
id-token: write
211214
strategy:
212215
max-parallel: 2
213216
fail-fast: false
@@ -227,14 +230,14 @@ jobs:
227230

228231
- name: Log in to DockerHub
229232
if: inputs.enable_dockerhub
230-
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4
233+
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4
231234
with:
232235
username: ${{ secrets.DOCKER_USERNAME }}
233236
password: ${{ secrets.DOCKERHUB_IMAGE_PUSH_TOKEN }}
234237

235238
- name: Log in to GHCR
236239
if: inputs.enable_ghcr
237-
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4
240+
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4
238241
with:
239242
registry: ghcr.io
240243
username: ${{ github.actor }}
@@ -289,7 +292,6 @@ jobs:
289292
images: ${{ steps.image-names.outputs.images }}
290293
tags: |
291294
type=semver,pattern={{version}},value=${{ steps.version.outputs.version }}
292-
type=semver,pattern={{major}}.{{minor}},value=${{ steps.version.outputs.version }}
293295
type=semver,pattern={{major}},value=${{ steps.version.outputs.version }},enable=${{ needs.prepare.outputs.is_release }}
294296
295297
- name: Build and push Docker image
@@ -320,12 +322,12 @@ jobs:
320322
ENABLE_GHCR: ${{ inputs.enable_ghcr }}
321323
DOCKERHUB_ORG: ${{ inputs.dockerhub_org }}
322324
APP_NAME: ${{ matrix.app.name }}
323-
GHCR_ORG: ${{ steps.normalize.outputs.owner_lower }}
325+
GHCR_ORG: ${{ inputs.ghcr_org || steps.normalize.outputs.owner_lower }}
324326
run: |
325327
REFS=""
326328
327329
if [ "$ENABLE_DOCKERHUB" == "true" ]; then
328-
REFS="${DOCKERHUB_ORG}/${APP_NAME}@${DIGEST}"
330+
REFS="docker.io/${DOCKERHUB_ORG}/${APP_NAME}@${DIGEST}"
329331
fi
330332
331333
if [ "$ENABLE_GHCR" == "true" ]; then
@@ -341,7 +343,7 @@ jobs:
341343
342344
- name: Sign container images with cosign
343345
if: inputs.enable_cosign_sign
344-
uses: LerianStudio/github-actions-shared-workflows/src/security/cosign-sign@feat/cosign-sign
346+
uses: LerianStudio/github-actions-shared-workflows/src/security/cosign-sign@v1.23.0
345347
with:
346348
image-refs: ${{ steps.cosign-refs.outputs.refs }}
347349

.github/workflows/gitops-update.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
steps:
7676
- name: Log in to Docker Hub
7777
if: ${{ inputs.enable_docker_login }}
78-
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4
78+
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4
7979
with:
8080
username: ${{ secrets.DOCKER_USERNAME }}
8181
password: ${{ secrets.DOCKERHUB_IMAGE_PULL_TOKEN }}
@@ -444,7 +444,25 @@ jobs:
444444
fi
445445
446446
git commit -am "ci(${{ steps.setup.outputs.commit_prefix }}): update image tags ($ENV_LABEL)" || echo "No changes to commit"
447-
git push origin main
447+
448+
# Retry push with rebase and exponential backoff to handle concurrent updates
449+
MAX_RETRIES=5
450+
for i in $(seq 1 $MAX_RETRIES); do
451+
if git push origin main; then
452+
echo "Push succeeded on attempt $i"
453+
break
454+
fi
455+
456+
if [ "$i" -eq "$MAX_RETRIES" ]; then
457+
echo "ERROR: Failed to push after $MAX_RETRIES attempts"
458+
exit 1
459+
fi
460+
461+
BACKOFF=$((2 ** i))
462+
echo "Push failed (attempt $i/$MAX_RETRIES), rebasing and retrying in ${BACKOFF}s..."
463+
sleep "$BACKOFF"
464+
git pull --rebase origin main
465+
done
448466
449467
# ArgoCD Sync Job - runs in parallel for each server/env combination
450468
argocd_sync:

.github/workflows/go-release.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ on:
7575
permissions:
7676
contents: write
7777
packages: write
78-
id-token: write
7978

8079
jobs:
8180
release:
@@ -102,7 +101,7 @@ jobs:
102101
run: ${{ inputs.test_cmd }}
103102

104103
- name: Run GoReleaser
105-
uses: goreleaser/goreleaser-action@9a127d869fb706213d29cdf8eef3a4ea2b869415 # v7
104+
uses: goreleaser/goreleaser-action@ec59f474b9834571250b370d4735c50f8e2d1e29 # v7
106105
with:
107106
distribution: ${{ inputs.goreleaser_distribution }}
108107
version: ${{ inputs.goreleaser_version }}
@@ -144,6 +143,10 @@ jobs:
144143
docker:
145144
name: Build and Push Docker Image
146145
runs-on: ${{ inputs.runner_type }}
146+
permissions:
147+
contents: read
148+
packages: write
149+
id-token: write
147150
needs: release
148151
if: inputs.enable_docker && startsWith(github.ref, 'refs/tags/v')
149152

@@ -155,7 +158,7 @@ jobs:
155158
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4
156159

157160
- name: Log in to Docker Registry
158-
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4
161+
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4
159162
with:
160163
registry: ${{ inputs.docker_registry }}
161164
username: ${{ secrets.DOCKER_USERNAME || github.actor }}
@@ -194,7 +197,7 @@ jobs:
194197
195198
- name: Sign container images with cosign
196199
if: inputs.enable_cosign_sign
197-
uses: LerianStudio/github-actions-shared-workflows/src/security/cosign-sign@feat/cosign-sign
200+
uses: LerianStudio/github-actions-shared-workflows/src/security/cosign-sign@v1.23.0
198201
with:
199202
image-refs: ${{ steps.cosign-refs.outputs.refs }}
200203

.github/workflows/gptchangelog.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
is_stable: ${{ steps.check-tag.outputs.is_stable }}
6363
steps:
6464
- name: Checkout for branch check
65-
uses: actions/checkout@v6
65+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
6666
with:
6767
fetch-depth: 0
6868

@@ -139,7 +139,7 @@ jobs:
139139

140140
- name: Checkout repository
141141
if: steps.check-tag.outputs.is_stable == 'true' || inputs.stable_releases_only == false
142-
uses: actions/checkout@v6
142+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
143143
with:
144144
fetch-depth: 0
145145

@@ -252,14 +252,14 @@ jobs:
252252

253253
steps:
254254
- name: Create GitHub App Token
255-
uses: actions/create-github-app-token@v2
255+
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3
256256
id: app-token
257257
with:
258258
app-id: ${{ secrets.LERIAN_STUDIO_MIDAZ_PUSH_BOT_APP_ID }}
259259
private-key: ${{ secrets.LERIAN_STUDIO_MIDAZ_PUSH_BOT_PRIVATE_KEY }}
260260

261261
- name: Checkout repository
262-
uses: actions/checkout@v6
262+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
263263
with:
264264
fetch-depth: 0
265265
token: ${{ steps.app-token.outputs.token }}
@@ -279,7 +279,7 @@ jobs:
279279
fi
280280
281281
- name: Import GPG key
282-
uses: crazy-max/ghaction-import-gpg@v7
282+
uses: crazy-max/ghaction-import-gpg@2dc316deee8e90f13e1a351ab510b4d5bc0c82cd # v7
283283
id: import_gpg
284284
with:
285285
gpg_private_key: ${{ secrets.LERIAN_CI_CD_USER_GPG_KEY }}
@@ -733,7 +733,7 @@ jobs:
733733
runs-on: blacksmith-4vcpu-ubuntu-2404
734734
steps:
735735
- name: Send Slack notification for sync PR
736-
uses: slackapi/slack-github-action@v1.24.0
736+
uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v1.24.0
737737
with:
738738
payload: |
739739
{

.github/workflows/helm-update-chart.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ jobs:
100100
steps:
101101
- name: Generate GitHub App Token
102102
id: app-token
103-
uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2
103+
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
104104
with:
105105
app-id: ${{ secrets.APP_ID }}
106106
private-key: ${{ secrets.APP_PRIVATE_KEY }}

.github/workflows/pr-security-scan.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ on:
6868
type: boolean
6969
default: true
7070
docker_build_args:
71-
description: 'Newline-separated Docker build arguments to pass to docker build (e.g., "APP_NAME=spi\nCOMPONENT_NAME=api"). Forwarded to docker/build-push-action build-args.'
71+
description: 'Newline-separated Docker build arguments (e.g., "APP_NAME=spi\nCOMPONENT_NAME=api"). For sensitive values (tokens, keys, passwords), use BuildKit secrets instead — build arguments are visible in image history.'
7272
type: string
7373
required: false
7474
default: ''
@@ -91,7 +91,7 @@ jobs:
9191
steps:
9292
# ----------------- Setup -----------------
9393
- name: Login to Docker Registry
94-
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4
94+
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4
9595
with:
9696
registry: ${{ inputs.docker_registry }}
9797
username: ${{ secrets.DOCKER_USERNAME }}
@@ -133,7 +133,7 @@ jobs:
133133
steps:
134134
# ----------------- Setup -----------------
135135
- name: Login to Docker Registry
136-
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4
136+
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4
137137
with:
138138
registry: ${{ inputs.docker_registry }}
139139
username: ${{ secrets.DOCKER_USERNAME }}

.github/workflows/release-notification.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,14 @@ jobs:
114114
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
115115
steps:
116116
- name: Create GitHub App token
117-
uses: actions/create-github-app-token@v2
117+
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3
118118
id: app-token
119119
with:
120120
app-id: ${{ secrets.APP_ID }}
121121
private-key: ${{ secrets.APP_PRIVATE_KEY }}
122122

123123
- name: Checkout
124-
uses: actions/checkout@v6
124+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
125125

126126
- name: Fetch latest release tag
127127
id: release

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ jobs:
103103
gpg_fingerprint: ${{ steps.import_gpg.outputs.fingerprint }}
104104

105105
steps:
106-
- uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2
106+
- uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
107107
id: app-token
108108
with:
109109
app-id: ${{ secrets.LERIAN_STUDIO_MIDAZ_PUSH_BOT_APP_ID }}

.github/workflows/typescript-build.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ on:
148148
permissions:
149149
contents: read
150150
packages: write
151-
id-token: write
152151

153152
jobs:
154153
prepare:
@@ -250,6 +249,10 @@ jobs:
250249
if: needs.prepare.outputs.has_builds == 'true'
251250
runs-on: ${{ inputs.runner_type }}
252251
name: Build ${{ matrix.app.name }}
252+
permissions:
253+
contents: read
254+
packages: write
255+
id-token: write
253256
strategy:
254257
max-parallel: 2
255258
fail-fast: false
@@ -317,7 +320,7 @@ jobs:
317320
fi
318321
319322
if [ "$ENABLE_DOCKERHUB" == "true" ]; then
320-
REFS="${DOCKERHUB_ORG}/${APP_NAME}@${DIGEST}"
323+
REFS="docker.io/${DOCKERHUB_ORG}/${APP_NAME}@${DIGEST}"
321324
fi
322325
323326
if [ "$ENABLE_GHCR" == "true" ]; then
@@ -333,7 +336,7 @@ jobs:
333336
334337
- name: Sign container images with cosign
335338
if: inputs.enable_cosign_sign && !inputs.dry_run && steps.cosign-refs.outputs.refs != ''
336-
uses: LerianStudio/github-actions-shared-workflows/src/security/cosign-sign@feat/cosign-sign
339+
uses: LerianStudio/github-actions-shared-workflows/src/security/cosign-sign@v1.23.0
337340
with:
338341
image-refs: ${{ steps.cosign-refs.outputs.refs }}
339342

0 commit comments

Comments
 (0)