Skip to content

Update Github Workflows #350

Update Github Workflows

Update Github Workflows #350

Workflow file for this run

name: Docker Build & Push
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
run_java_tests:
name: Run Java tests
uses: ./.github/workflows/run-java-tests.yml
push_to_registry:
needs: run_java_tests
name: Build & Push docker image to Docker Hub
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Extract metadata to env variables
uses: HSLdevcom/jore4-tools/github-actions/extract-metadata@extract-metadata-v1
- name: Pull previous images to support caching
run: |
docker pull $IMAGE_NAME:builder || >&2 echo "Previous builder image not found"
docker pull $IMAGE_NAME:latest || >&2 echo "Previous image not found"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: 'arm64'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.JORE4_DOCKERHUB_USER }}
password: ${{ secrets.JORE4_DOCKERHUB_TOKEN }}
- name: Build and push image tagged with commit ID to Docker Hub
run: |
docker buildx build \
--push \
--platform linux/amd64,linux/arm64 \
--cache-from=$IMAGE_NAME:builder \
--cache-from=$IMAGE_NAME:latest \
-t $IMAGE_NAME:$COMMIT_ID \
.
- name: Build and push :builder and :latest tag to Docker Hub
if: ${{ github.ref == 'refs/heads/main' }}
run: |
docker buildx build \
--push \
--platform linux/amd64,linux/arm64 \
--target builder \
--cache-from=$IMAGE_NAME:builder \
-t $IMAGE_NAME:builder \
.
docker buildx build \
--push \
--platform linux/amd64,linux/arm64 \
--cache-from=$IMAGE_NAME:builder \
--cache-from=$IMAGE_NAME:latest \
-t $IMAGE_NAME:latest \
.
run_cypress_tests:
needs:
- run_java_tests
- push_to_registry
uses: ./.github/workflows/run-cypress-tests.yml