Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Make able to run workflow in forks with uppercase in names #782

Merged
16 changes: 10 additions & 6 deletions .github/workflows/build-image-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ jobs:
.github/workflows/build-image-test.yaml
tools/*.sh

- name: Set IMAGE environment variable
# Lowercase the org/repo name to allow for workflow to run in forks,
# which owners have uppercase letters in username
run: >-
echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY@L}:${{ env.IMAGE_TAG }}"
MaxymVlasov marked this conversation as resolved.
Show resolved Hide resolved
>> $GITHUB_ENV
- name: Set up QEMU
if: matrix.os != 'ubuntu-latest' || matrix.arch != 'amd64'
# yamllint disable-line rule:line-length
Expand All @@ -56,8 +62,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 +73,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 +100,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
11 changes: 8 additions & 3 deletions .github/workflows/build-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ jobs:
|| echo 'latest'
) >> $GITHUB_ENV

- name: Set IMAGE_REPO environment variable
# Lowercase the org/repo name to allow for workflow to run in forks,
# which owners have uppercase letters in username
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 +57,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 +75,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
Loading