Skip to content

Commit

Permalink
ci: Make able to run workflow in forks with uppercase in names
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxymVlasov committed Jan 24, 2025
1 parent 917f4d0 commit 97d87f4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/build-image-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ jobs:
.github/workflows/build-image-test.yaml
tools/*.sh
- name: Set IMAGE environment variable
# Lowercase the repo name for make able to run workflow in forks,
# which owners have uppercase letters in nickname
run: >-
echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY@L}:${{ env.IMAGE_TAG }}"
>> $GITHUB_ENV
- name: Set up QEMU
if: matrix.os != 'ubuntu-latest' || matrix.arch != 'amd64'
# yamllint disable-line rule:line-length
Expand All @@ -56,8 +63,7 @@ jobs:
linux/${{ matrix.arch }}
push: false
load: true
tags: |
ghcr.io/${{ github.repository }}:${{ env.IMAGE_TAG }}
tags: ${{ env.IMAGE }}
# Fix multi-platform: https://github.com/docker/buildx/issues/1533
provenance: false
secrets: |
Expand All @@ -68,15 +74,15 @@ jobs:
# yamllint disable-line rule:line-length
uses: plexsystems/container-structure-test-action@c0a028aa96e8e82ae35be556040340cbb3e280ca # v0.3.0
with:
image: ghcr.io/${{ github.repository }}:${{ env.IMAGE_TAG }}
image: ${{ env.IMAGE }}
config: .github/.container-structure-test-config.yaml

- name: Dive - check image for waste files
if: steps.changed-files-specific.outputs.any_changed == 'true'
# yamllint disable-line rule:line-length
uses: MaxymVlasov/dive-action@379af3fc636888ada5899c997e8b52db6ad45023 # v1.0.1
with:
image: ghcr.io/${{ github.repository }}:${{ env.IMAGE_TAG }}
image: ${{ env.IMAGE }}
config-file: ${{ github.workspace }}/.github/.dive-ci.yaml
github-token: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -95,8 +101,7 @@ jobs:
INSTALL_ALL=true
platforms: linux/amd64,linux/arm64
push: false
tags: |
ghcr.io/${{ github.repository }}:${{ env.IMAGE_TAG }}
tags: ${{ env.IMAGE }}
# Fix multi-platform: https://github.com/docker/buildx/issues/1533
provenance: false
secrets: |
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/build-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ jobs:
|| echo 'latest'
) >> $GITHUB_ENV
- name: Set IMAGE_REPO environment variable
# Lowercase the repo name for make able to run workflow in forks,
# which owners have uppercase letters in nickname
run: >-
echo "IMAGE_REPO=ghcr.io/${GITHUB_REPOSITORY@L}" >> $GITHUB_ENV
- name: Set up Docker Buildx
# yamllint disable-line rule:line-length
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0
Expand All @@ -52,8 +58,8 @@ jobs:
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/${{ github.repository }}:${{ env.IMAGE_TAG }}
ghcr.io/${{ github.repository }}:latest
${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }}
${{ env.IMAGE_REPO }}:latest
# Fix multi-platform: https://github.com/docker/buildx/issues/1533
provenance: false
secrets: |
Expand All @@ -70,7 +76,7 @@ jobs:
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/${{ github.repository }}:nightly
${{ env.IMAGE_REPO }}:nightly
# Fix multi-platform: https://github.com/docker/buildx/issues/1533
provenance: false
secrets: |
Expand Down

0 comments on commit 97d87f4

Please sign in to comment.