Skip to content

Commit 0e09641

Browse files
committed
ci: drop FranzDiebold/github-env-vars-action #9641
This drops the `FranzDiebold/github-env-vars-action` in favor of native GH-Actions replacement patterns available. ghcr.io (and other container registries for that matter) do not allow mix-case image names, so when a the repo is forked by a user with a mixed case username, or when reused in a repo with a mixed case repo name, the Docker image tagging step fails. When a lowercase username is needed it is now dynamically bash-eval'd directly in the called line. Notable replacements: - `${{ env.CI_REPOSITORY_OWNER_SLUG }}`: `$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')` - `${{ env.CI_REPOSITORY_NAME }}`: `${{ github.event.repository.name }}` Related: [#9639](http://team.linkorb.com/cards/9639).
1 parent 841489e commit 0e09641

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

.github/workflows/production.yml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ jobs:
2020
- php8
2121

2222
steps:
23-
- name: GitHub Environment Variables Action
24-
uses: FranzDiebold/github-env-vars-action@v2
25-
2623
- name: Shallow clone code
2724
uses: actions/checkout@v4
2825
with:
@@ -32,7 +29,7 @@ jobs:
3229
uses: docker/login-action@v3
3330
with:
3431
registry: ghcr.io
35-
username: ${{ env.CI_REPOSITORY_OWNER_SLUG }}
32+
username: ${{ github.repository_owner }} # ghcr logins allow mixed case usernames
3633
password: ${{ secrets.GITHUB_TOKEN }}
3734

3835
- name: Build the container image
@@ -49,35 +46,33 @@ jobs:
4946
severity: 'CRITICAL,HIGH'
5047

5148
- name: Retag new image with latest tag so we can push the scanned version
52-
run: docker image tag php-docker-base:trivytemp ghcr.io/${{ env.CI_REPOSITORY_OWNER_SLUG }}/${{ env.CI_REPOSITORY_NAME }}:${{ matrix.php }}
49+
run: docker image tag php-docker-base:trivytemp "ghcr.io/$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]'):${{ matrix.php }}"
5350

5451
- name: Push with commit ${{ matrix.php }} tag
55-
run: docker push ghcr.io/${{ env.CI_REPOSITORY_OWNER_SLUG }}/${{ env.CI_REPOSITORY_NAME }}:${{ matrix.php }}
52+
run: docker push "ghcr.io/$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]'):${{ matrix.php }}"
5653

5754
#review containers
5855
- name: Build the review container image
59-
run: docker build . --tag ghcr.io/${{ github.repository_owner }}/${{ env.CI_REPOSITORY_NAME }}:${{ matrix.php }}-review --file Dockerfile.${{ matrix.php }}-review
60-
- name: Push with commit *-review tag
61-
run: docker push ghcr.io/${{ env.CI_REPOSITORY_OWNER_SLUG }}/${{ env.CI_REPOSITORY_NAME }}:${{ matrix.php }}-review
56+
run: docker build . --tag "ghcr.io/$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]'):${{ matrix.php }}-review" --file Dockerfile.${{ matrix.php }}-review
6257

58+
- name: Push with commit *-review tag
59+
run: docker push "ghcr.io/$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]'):${{ matrix.php }}-review"
6360

6461
cleanup:
6562
needs: [build]
6663
runs-on: ubuntu-latest
6764
steps:
68-
- name: GitHub Environment Variables Action
69-
uses: FranzDiebold/github-env-vars-action@v2
7065

7166
- name: Login to Container Registry ghcr.io
7267
uses: docker/login-action@v3
7368
with:
7469
registry: ghcr.io
75-
username: ${{ env.CI_REPOSITORY_OWNER_SLUG }}
70+
username: ${{ github.repository_owner }} #ghcr logins allow mixed case usernames
7671
password: ${{ secrets.GITHUB_TOKEN }}
7772

7873
- name: Delete old versions of the package, keeping a few of the newest
7974
uses: actions/delete-package-versions@v5
8075
with:
81-
package-name: ${{ env.CI_REPOSITORY_NAME }}
76+
package-name: ${{ github.event.repository.name }}
8277
package-type: container
8378
min-versions-to-keep: 8

0 commit comments

Comments
 (0)