fix(ct): base image build matrix output must be on a single line #423
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Base Container Image | |
on: | |
push: | |
tags: | |
- 'v[6-9].*' | |
branches: | |
- 'develop' | |
- '10478-version-base-img' | |
paths: | |
- 'modules/container-base/**' | |
- 'modules/dataverse-parent/pom.xml' | |
- '.github/workflows/container_base_push.yml' | |
schedule: | |
- cron: '23 3 * * 0' # Run for 'develop' every Sunday at 03:23 UTC | |
env: | |
PLATFORMS: linux/amd64,linux/arm64 | |
jobs: | |
discover: | |
name: Discover Release Matrix | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: read | |
# Only run in upstream repo - avoid unnecessary runs in forks and only for scheduled | |
if: ${{ github.repository_owner == 'IQSS' }} | |
outputs: | |
branches: ${{ steps.matrix.outputs.branches }} | |
steps: | |
- name: Build branch matrix options | |
id: matrix | |
run: | | |
# Get last three releases and include develop branch as matrix elements | |
#if [[ "${{ github.event_name }}" == "schedule" ]]; then | |
echo "branches=$(curl -f -sS https://api.github.com/repos/IQSS/dataverse/releases | \ | |
jq '[ .[0:3] | .[].tag_name, "develop" ]')" | tr -d "\n" | tr -s " " | \ | |
tee -a "$GITHUB_OUTPUT" | |
#else | |
# echo "branches=['develop']" | tee -a "$GITHUB_OUTPUT" | |
#fi | |
build: | |
name: Build image | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: read | |
needs: discover | |
strategy: | |
matrix: | |
branch: ${{ fromJson(needs.discover.outputs.branches) }} | |
# Only run in upstream repo - avoid unnecessary runs in forks | |
if: ${{ github.repository_owner == 'IQSS' }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ matrix.branch }} | |
- name: Determine Java version from package | |
run: | | |
echo "JAVA_VERSION=$(mvn -f modules/container-base -Pct help:evaluate -Dexpression=target.java.version -q -DforceStdout)" >> ${GITHUB_ENV} | |
- name: Set up JDK ${{ env.JAVA_VERSION }} | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
distribution: 'temurin' | |
cache: 'maven' | |
cache-dependency-path: | | |
modules/container-base/pom.xml | |
- name: Stop on purpose for testing | |
uses: actions/github-script@v3 | |
with: | |
script: | | |
core.setFailed('Stopped on purpose.') | |
# Note: Accessing, pushing tags etc. to DockerHub will only succeed in upstream and | |
# on events in context of upstream because secrets. PRs run in context of forks by default! | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up QEMU for multi-arch builds | |
uses: docker/setup-qemu-action@v2 | |
- name: Deploy multi-arch base container image to Docker Hub | |
run: mvn -f modules/container-base -Pct deploy -Ddocker.platforms=${{ env.PLATFORMS }} | |
- if: ${{ github.event_name == 'push' && github.ref_name == 'develop' }} | |
name: Push description to DockerHub | |
uses: peter-evans/dockerhub-description@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
repository: gdcc/base | |
short-description: "Dataverse Base Container image providing Payara application server and optimized configuration" | |
readme-filepath: ./modules/container-base/README.md | |
push-app-img: | |
name: "Rebase & Publish App Image" | |
permissions: | |
contents: read | |
packages: write | |
pull-requests: write | |
needs: build | |
# We do not release a new base image for pull requests, so do not trigger. | |
# if: ${{ github.event_name != 'pull_request' }} | |
uses: ./.github/workflows/container_app_push.yml | |
secrets: inherit |