Skip to content
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PRs » Build container image
name: Build » Container image

on:
push:
Expand All @@ -22,16 +22,16 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push images
- name: Build image
uses: docker/build-push-action@v6
with:
push: false # This is handled in another workflow!
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=docker,dest=${{ runner.temp }}/build.tar

- name: Upload docker image to GHA
- name: Upload docker image to GHA artifacts
uses: actions/upload-artifact@v4
with:
name: build
name: ${{ github.run_id }}
path: ${{ runner.temp }}/build.tar
2 changes: 1 addition & 1 deletion .github/workflows/pr-build-test-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
- name: Upload build to GHA
uses: actions/upload-artifact@v4
with:
name: build
name: ${{ github.run_id }}
path: ${{ runner.temp }}/build.tar


Expand Down
19 changes: 9 additions & 10 deletions .github/workflows/pr-deploy-container-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: PRs » Push container image

on:
workflow_run:
workflows: ["PRs » Build container image"]
workflows: ["Build » Container image"]
types:
- completed

Expand All @@ -13,6 +13,7 @@ jobs:
contents: read
packages: write
pull-requests: write
if: github.event.workflow_run.event == 'pull_request'
steps:
- name: Log in to the container registry
uses: docker/login-action@v3
Expand All @@ -21,28 +22,26 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}

- name: Download docker image from GHA
uses: actions/download-artifact@v4
with:
name: build
name: ${{ github.event.workflow_run.id }}
path: ${{ runner.temp }}
github-token: ${{ github.token }}
run-id: ${{ github.event.workflow_run.id }}

- name: Load image
run: |
docker load --input ${{ runner.temp }}/build.tar
docker push ghcr.io/${{ github.repository }}

- name: Push main branch image
run: |
docker push ghcr.io/${{ github.repository_owner }}/admin-interface:pr-${{ github.event.workflow_run.pull_requests[0].number }}

- name: Add comment
if: github.event_name == 'pull_request'
uses: thollander/actions-comment-pull-request@v3
with:
pr-number: ${{ github.event.workflow_run.pull_requests[0].number }}
comment-tag: container-image
message: |
Use `docker` or `podman` to test this pull request locally.
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/pr-deploy-test-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ jobs:
- name: Fetch build from GHA
uses: actions/download-artifact@v4
with:
name: build
path: ${{ runner.temp }}/build.tar
name: ${{ github.event.workflow_run.id }}
path: ${{ runner.temp }}/
github-token: ${{ github.token }}
run-id: ${{ github.event.workflow_run.id }}

- name: Store build in the clone
Expand Down Expand Up @@ -73,7 +74,7 @@ jobs:
working-directory: admin-interface-test
run: |
git add .
git commit --amend -m "Build ${{ steps.build-path.outputs.build }}"
git commit --amend -m "Build ${{ github.event.workflow_run.pull_requests[0].number }}"

- name: Force push admin interface test branch
working-directory: admin-interface-test
Expand All @@ -83,6 +84,7 @@ jobs:
- name: Add comment with deployment location
uses: thollander/actions-comment-pull-request@v3
with:
pr-number: ${{ github.event.workflow_run.pull_requests[0].number }}
comment-tag: static-test-deployment
message: >
This pull request is deployed at
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-remove-test-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

- name: Clone test repository
run: |
git clone -b gh-pages "git@github.com:opencast/admin-interface-test.git" admin-interface-test
git clone -b gh-pages "git@github.com:${{ github.repository_owner }}/admin-interface-test.git" admin-interface-test

- name: Delete build if present
working-directory: admin-interface-test
Expand Down
Loading