-
-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add publishing of release images to GitHub Registry
- Loading branch information
1 parent
0f8dcf3
commit faa4217
Showing
1 changed file
with
63 additions
and
2 deletions.
There are no files selected for viewing
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
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 | ||
|
@@ -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 }} |