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

tweak(github/ci): registry auth and lowercase image name #3220

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/build_alpine_container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ jobs:
sparse-checkout-cone-mode: true
fetch-depth: 1
submodules: false
- name: Convert repo name to lowercase
id: repo_name
run: echo "REPO_NAME_LOWER=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
Expand All @@ -33,19 +37,19 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.IMAGE_NAME }}
images: ${{ env.REGISTRY }}/${{ env.REPO_NAME_LOWER }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
file: code/tools/ci/docker-builder/Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.IMAGE_NAME }}:latest
tags: ${{ env.REGISTRY }}/${{ env.REPO_NAME_LOWER }}/${{ env.IMAGE_NAME }}:latest
labels: ${{ steps.meta.outputs.labels }}

- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2
with:
subject-name: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.IMAGE_NAME }}
subject-name: ${{ env.REGISTRY }}/${{ env.REPO_NAME_LOWER }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
5 changes: 4 additions & 1 deletion .github/workflows/ci/build_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ ROOT_REPO=$(pwd)
IMAGE_NAME="fivem-builder-linux-alpine"
IMAGE_TAG="latest"
REGISTRY="ghcr.io"
IMAGE_PATH="${REGISTRY}/${GITHUB_REPOSITORY}/${IMAGE_NAME}:${IMAGE_TAG}"

REPO_NAME_LOWER="${GITHUB_REPOSITORY,,}"

IMAGE_PATH="${REGISTRY}/${REPO_NAME_LOWER}/${IMAGE_NAME}:${IMAGE_TAG}"

echo "Pulling Docker image from $IMAGE_PATH..."
docker pull $IMAGE_PATH
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/ci_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ name: CI Build all products
on:
workflow_call:

permissions: {}
permissions:
packages: read

jobs:
build_all:
Expand Down Expand Up @@ -50,7 +51,15 @@ jobs:
shell: bash
run: |
mkdir -p "$ROOT_DEP" && cd "$_" || exit 1
- name: Log in to the Container registry
if: ${{ matrix.builds[2] == 'linux' }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Compile
shell: bash
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pr_opened.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ jobs:
build_all:
name: Build
permissions:
packages: read
needs: input_validation
if: ${{ needs.input_validation.outputs.requires_compilation == 'true' }}
uses: ./.github/workflows/ci_build.yml
Expand Down