Skip to content

Commit

Permalink
Add publishing of release images to GitHub Registry
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg-nenashev committed Feb 7, 2023
1 parent 0f8dcf3 commit faa4217
Showing 1 changed file with 63 additions and 2 deletions.
65 changes: 63 additions & 2 deletions .github/workflows/publish-release-artifact.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
name: Publish artifact
name: Publish Release Artifacts

on:
release:
types: [published]

env:
IMAGE_NAME: ${{ github.repository }}
REGISTRY: ghcr.io

jobs:
build:
gh-release_artifacts:
runs-on: ubuntu-latest
name: Publish Artifacts to GitHub Releases

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -42,3 +47,59 @@ jobs:
asset_path: ./${{ steps.fetch-artifact.outputs.file-name }}-${{ steps.set-version.outputs.project-version }}.zip
asset_name: ${{ steps.fetch-artifact.outputs.file-name }}-${{ steps.set-version.outputs.project-version }}.zip
asset_content_type: application/zip

gh-registry-images:
name: "Deploy Docker Image: ${{ matrix.alias }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- alias: jre-11
dockerfile: packaging/docker/unix/eclipse-temurin-11-jre/Dockerfile
tag-prefix: eclipse-temurin-11-jre-
tag-latest: true
extra-tags: ", ghcr.io/${{ github.repository }}:jre-11"
- alias: jre-11-alpine
dockerfile: packaging/docker/unix/eclipse-temurin-11-jre-alpine/Dockerfile
tag-prefix: eclipse-temurin-11-jre-alpine-
tag-latest: false
extra-tags: ", ghcr.io/${{ github.repository }}:alpine, ghcr.io/${{ github.repository }}:jre-11-alpine"
permissions:
contents: read
packages: write


#TODO: There is slight double build overhead, but we prevent permissions from being exposed too widely
steps:
- uses: actions/checkout@v2
- name: determine version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Log in to the Container registry
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=${{ matrix.tag-latest }}
prefix=${{ matrix.tag-prefix }}
suffix=${{ env.RELEASE_VERSION }}
- name: Build and Deploy Docker image
uses: docker/[email protected]
with:
context: .
file: ${{ matrix.dockerfile }}
push: true
tags: ${{ steps.meta.outputs.tags }} ${{ matrix.extra-tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit faa4217

Please sign in to comment.