Skip to content

Commit

Permalink
fix(github-actions): GHCR upload (#505)
Browse files Browse the repository at this point in the history
* 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 :(
  • Loading branch information
rti authored and RickiJay-WMDE committed Nov 9, 2023
1 parent f81b56a commit b2ead8d
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -284,9 +285,10 @@ jobs:
strategy:
fail-fast: false
matrix:
component:
docker_image:
[
"wikibase",
"wikibase-bundle",
"elasticsearch",
"wdqs",
"wdqs-frontend",
Expand All @@ -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 }}

0 comments on commit b2ead8d

Please sign in to comment.