From 54fe727102aa4a2eaaae33bae58ce75b81b2fa24 Mon Sep 17 00:00:00 2001 From: rti Date: Wed, 8 Nov 2023 12:20:48 +0100 Subject: [PATCH] fix(github-actions): GHCR upload (#505) * fix(github-actions): GITHUB_TOKEN access for GHCR upload * fix(github-actions): docker image name * chore: move if to job level * fix: get built docker artifacts in ghcr upload job * fix(github-actions): ghcr image name * chore: run upload ghcr only on main and mw-?.?? branches * fix: simplify job run check, we do not have regex here :( --- .github/workflows/build_and_test.yml | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index a37e728c0..2be85b99b 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -275,6 +275,7 @@ jobs: upload_ghcr: runs-on: ubuntu-latest timeout-minutes: 20 + if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/mw-') needs: - test @@ -284,9 +285,10 @@ jobs: strategy: fail-fast: false matrix: - component: + docker_image: [ "wikibase", + "wikibase-bundle", "elasticsearch", "wdqs", "wdqs-frontend", @@ -297,17 +299,28 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Get built Docker images + uses: actions/download-artifact@v3 + with: + name: DockerImages + path: artifacts/ + + - name: Load docker images + shell: bash + run: | + for file in artifacts/*.docker.tar.gz; do + docker load -i "$file" + done + - name: Login to GitHub Container Registry uses: docker/login-action@v3 - if: github.ref == 'refs/heads/main' with: registry: ghcr.io username: ${{ github.repository_owner }} - password: ${{ inputs.github_token }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Store built docker image on GHCR - if: github.ref == 'refs/heads/main' uses: wmde/tag-push-ghcr-action@v3 with: - image_name: "wikibase/${{ inputs.name }}" + image_name: ${{ matrix.docker_image }} tag: ${{ github.run_id }}