From f2f8e7dac0d5d3d0e89a463a3a1683bea402f932 Mon Sep 17 00:00:00 2001 From: Bart Geesink Date: Thu, 1 Feb 2024 16:45:44 +0100 Subject: [PATCH] GHA Docker: Add labels and tags --- .github/workflows/deploy.yml | 38 ++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 46e1ed40..53a223da 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -47,6 +47,28 @@ jobs: exit 1 if: github.event_name != 'workflow_dispatch' && steps.versioncheck.outputs.version != github.ref_name + - name: Set up JDK 11 for snapshots + uses: actions/setup-java@v3 + with: + java-version: "11" + distribution: "temurin" + cache: "maven" + server-id: openconext-snapshots + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + if: ( endsWith(steps.versioncheck.outputs.version, '-SNAPSHOT')) + + - name: Set up JDK 11 for releases + uses: actions/setup-java@v3 + with: + java-version: "11" + distribution: "temurin" + cache: "maven" + server-id: openconext-releases + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + if: ${{!( endsWith(steps.versioncheck.outputs.version, '-SNAPSHOT')) }} + - name: Deploy with Maven run: mvn --batch-mode deploy -DskipTests env: @@ -63,6 +85,18 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/openconext/openconext-oidcng/oidcng + flavor: | + latest=false + tags: | + type=ref,event=tag + type=semver,pattern={{version}},value=${{ steps.versioncheck.outputs.version }} + type=sha + - name: Build and push the oidcng-server uses: docker/build-push-action@v4 with: @@ -70,5 +104,5 @@ jobs: file: docker/Dockerfile platforms: linux/amd64 push: true - tags: | - ghcr.io/openconext/openconext-oidcng/oidcng-server:${{ steps.versioncheck.outputs.version }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}