Skip to content

Commit 8831dad

Browse files
committed
fix(ci): lowercase repo via bash, not the nonexistent lower() fn
GitHub Actions expressions do NOT have a lower() function (only contains(), startsWith(), endsWith(), format(), join(), toJSON(), fromJSON(), success(), failure(), always(), and a few others). The previous attempt used ${{ lower(github.repository) }} and the workflow refused to start with: (Line: 283, Col: 20): Unrecognized function: 'lower' Fix: do the lowercasing in bash via tr '[:upper:]' '[:lower:]', which is available in the runner's coreutils. The lowercase value is computed once in the build job's "Compute image tags" step and exposed as a step output (repo_lc). The build job also exposes it as a job output so the release job can reuse it without recomputing. Three consumers: 1. Build step tag construction: ghcr.io/${REPO_LC}:<version> 2. Build step org.opencontainers.image.source label: ${{ steps.tags.outputs.repo_lc }} 3. Release body docker pull examples: ${{ needs.build.outputs.repo_lc }} Verified: - YAML parses cleanly (PyYAML) - grep finds zero ${{ ... lower(...) ... }} expressions - tr lowercases 'IamCoder18/OpenBlog' → 'iamcoder18/openblog' in shell
1 parent 47ae424 commit 8831dad

1 file changed

Lines changed: 17 additions & 10 deletions

File tree

.github/workflows/publish.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ jobs:
238238

239239
outputs:
240240
digest: ${{ steps.build.outputs.digest }}
241+
repo_lc: ${{ steps.tags.outputs.repo_lc }}
241242

242243
steps:
243244
- uses: actions/checkout@v4
@@ -274,15 +275,20 @@ jobs:
274275
MAJOR_MINOR: ${{ needs.version.outputs.major_minor }}
275276
MAJOR: ${{ needs.version.outputs.major }}
276277
IS_PRERELEASE: ${{ needs.version.outputs.is_prerelease }}
277-
# Docker requires the repository portion of a tag to be
278-
# all-lowercase. `github.repository` preserves the owner/
279-
# repo casing as it appears in the URL (e.g.
280-
# "IamCoder18/OpenBlog"), so lowercase it for the tag
281-
# while keeping the mixed-case value for the OCI source
282-
# label (URLs are case-insensitive, so that's fine).
283-
REPO_LC: ${{ lower(github.repository) }}
278+
GITHUB_REPOSITORY_RAW: ${{ github.repository }}
284279
run: |
285280
set -euo pipefail
281+
# Docker requires the repository portion of an image tag to be
282+
# all-lowercase. github.repository preserves the owner/repo
283+
# casing as it appears in the GitHub URL (e.g. "IamCoder18/
284+
# OpenBlog"), so we lowercase it before constructing tags.
285+
#
286+
# Note: GitHub Actions expressions do NOT have a `lower()`
287+
# function, so the conversion happens in bash here. The result
288+
# is exposed as `repo_lc` for downstream steps and the release
289+
# job to reuse (e.g. for the org.opencontainers.image.source
290+
# label and the `docker pull` examples in the release body).
291+
REPO_LC="$(printf '%s' "$GITHUB_REPOSITORY_RAW" | tr '[:upper:]' '[:lower:]')"
286292
TAGS="ghcr.io/${REPO_LC}:${VERSION}"
287293
TAGS="${TAGS},ghcr.io/${REPO_LC}:${MAJOR_MINOR}"
288294
TAGS="${TAGS},ghcr.io/${REPO_LC}:${MAJOR}"
@@ -291,6 +297,7 @@ jobs:
291297
fi
292298
{
293299
echo "tags=${TAGS}"
300+
echo "repo_lc=${REPO_LC}"
294301
echo "is_prerelease=${IS_PRERELEASE}"
295302
} >> "$GITHUB_OUTPUT"
296303
echo "Computed tags:"
@@ -308,7 +315,7 @@ jobs:
308315
labels: |
309316
org.opencontainers.image.title=OpenBlog
310317
org.opencontainers.image.description=Self-hostable AI-agent-friendly blog platform
311-
org.opencontainers.image.source=${{ github.server_url }}/${{ lower(github.repository) }}
318+
org.opencontainers.image.source=${{ github.server_url }}/${{ steps.tags.outputs.repo_lc }}
312319
org.opencontainers.image.licenses=MIT
313320
org.opencontainers.image.version=${{ needs.version.outputs.version }}
314321
provenance: mode=max
@@ -386,8 +393,8 @@ jobs:
386393
## Docker image
387394
388395
```bash
389-
docker pull ghcr.io/${{ lower(github.repository) }}:${{ needs.version.outputs.tag }}
390-
docker pull ghcr.io/${{ lower(github.repository) }}:latest
396+
docker pull ghcr.io/${{ needs.build.outputs.repo_lc }}:${{ needs.version.outputs.tag }}
397+
docker pull ghcr.io/${{ needs.build.outputs.repo_lc }}:latest
391398
```
392399
393400
Image digest: `${{ needs.build.outputs.digest }}`

0 commit comments

Comments
 (0)