Skip to content

Commit b61de02

Browse files
committed
ci: auto-commit generated Dockerfiles and update README after publish
- Remove /generated/ from .gitignore so Dockerfiles are tracked in git - Add {{IMAGE_FULL_NAME}} template variable to README.md.template so the table header reflects the actual registry (fork vs upstream) - Update-Readme now substitutes {{IMAGE_FULL_NAME}} from $imagePrefix - Add update-repo job to publish-fork.yaml and publish.yaml: after every successful publish, Prepare + Update-Readme run and changes are committed back with [skip ci] — preventing broken Dockerfile links
1 parent 0bd74f9 commit b61de02

5 files changed

Lines changed: 79 additions & 4 deletions

File tree

.github/workflows/publish-fork.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,3 +256,42 @@ jobs:
256256
$(($tags | ForEach-Object { "docker pull $registry/${imageName}:$_" }) -join "`n")
257257
``````
258258
"@ >> $env:GITHUB_STEP_SUMMARY
259+
260+
# Generates all Dockerfiles and updates README.md, then commits them back to the repo.
261+
# This ensures Dockerfile links in README.md are always valid on GitHub.
262+
update-repo:
263+
needs: [build-and-push, create-manifests]
264+
if: |
265+
always() &&
266+
needs.build-and-push.result == 'success' &&
267+
(needs.create-manifests.result == 'success' || needs.create-manifests.result == 'skipped')
268+
permissions:
269+
contents: write
270+
runs-on: ubuntu-latest
271+
steps:
272+
- name: Checkout
273+
uses: actions/checkout@v6
274+
275+
- name: Install tools
276+
shell: pwsh
277+
run: |
278+
Install-Module InvokeBuild -Force
279+
Install-Module PSFirebird -MinimumVersion '1.0.0' -Force
280+
281+
- name: Generate Dockerfiles and update README
282+
shell: pwsh
283+
run: |
284+
Invoke-Build Prepare
285+
Invoke-Build Update-Readme -Registry '${{ env.REGISTRY }}'
286+
287+
- name: Commit and push changes
288+
run: |
289+
git config user.name "github-actions[bot]"
290+
git config user.email "github-actions[bot]@users.noreply.github.com"
291+
git add generated/ README.md
292+
if git diff --cached --quiet; then
293+
echo "No changes to commit"
294+
else
295+
git commit -m "chore: update generated Dockerfiles and README [skip ci]"
296+
git push
297+
fi

.github/workflows/publish.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,39 @@ jobs:
120120
shell: pwsh
121121
run: |
122122
Invoke-Build Publish-Manifests
123+
124+
# Generates all Dockerfiles and updates README.md, then commits them back to the repo.
125+
# This ensures Dockerfile links in README.md are always valid on GitHub.
126+
update-repo:
127+
if: ${{ github.repository == 'FirebirdSQL/firebird-docker' }}
128+
needs: create-manifests
129+
permissions:
130+
contents: write
131+
runs-on: ubuntu-latest
132+
steps:
133+
- name: Checkout
134+
uses: actions/checkout@v6
135+
136+
- name: Install tools
137+
shell: pwsh
138+
run: |
139+
Install-Module InvokeBuild -Force
140+
Install-Module PSFirebird -MinimumVersion '1.0.0' -Force
141+
142+
- name: Generate Dockerfiles and update README
143+
shell: pwsh
144+
run: |
145+
Invoke-Build Prepare
146+
Invoke-Build Update-Readme
147+
148+
- name: Commit and push changes
149+
run: |
150+
git config user.name "github-actions[bot]"
151+
git config user.email "github-actions[bot]@users.noreply.github.com"
152+
git add generated/ README.md
153+
if git diff --cached --quiet; then
154+
echo "No changes to commit"
155+
else
156+
git commit -m "chore: update generated Dockerfiles and README [skip ci]"
157+
git push
158+
fi

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# Temporary files
22
/tmp/
33

4-
# Generated output
5-
/generated/
6-
74
# Logs
85
*.log

firebird-docker.build.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,11 @@ task Update-Readme LoadAssets, {
213213
}
214214
}
215215

216+
$imageFullName = "$script:imagePrefix/firebird"
217+
216218
$template = Get-Content './src/README.md.template' -Raw -Encoding UTF8
217219
$content = $template.Replace('{{SupportedTags}}', ($TSupportedTags -join ''))
220+
$content = $content.Replace('{{IMAGE_FULL_NAME}}', $imageFullName)
218221
Write-GeneratedFile -Content $content -Destination './README.md'
219222
}
220223

src/README.md.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Docker images for Firebird Database.
1414

1515
# Supported tags
1616

17-
|`firebirdsql/firebird`|Dockerfile|
17+
|`{{IMAGE_FULL_NAME}}`|Dockerfile|
1818
|:-|:-:|
1919
{{SupportedTags}}
2020

0 commit comments

Comments
 (0)