-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add github action to build and upload theme Docker images.
- Loading branch information
Showing
2 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
.github/workflows/build_and_upload_theme_on_push_to_dev.yaml
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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Jobs to build and deploy a Docker image for Fairspace Keycloak theme on push to the dev or release branches | ||
|
||
name: Build & Upload Fairspace Keycloak Theme Docker image | ||
|
||
env: | ||
DOCKER_REGISTRY: ghcr.io | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
- release | ||
|
||
jobs: | ||
# A job to generate one shared unique version tag per build cycle for all built artifacts | ||
generate-version: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
output1: ${{ steps.version.outputs.keycloak_fairspace_theme_version }} | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- id: version | ||
name: Generating version tag for artifacts | ||
run: | | ||
# EXTRACT VERSION | ||
BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} | ||
echo "Building theme image from the branch: $BRANCH" | ||
VER=$(cat ./themes/VERSION) | ||
echo "Building theme image of version: $VER" | ||
# DOCKER TAG TO BE ATTACHED (SHARED WITHIN OUTPUT): | ||
if [ $BRANCH != "release" ] | ||
then | ||
VER=$VER-SNAPSHOT | ||
fi | ||
echo "keycloak_fairspace_theme_version=$VER" >> "$GITHUB_OUTPUT" | ||
echo "Docker tag to be attached to images: $VER" | ||
build-and-upload-docker-image-for-keycloak-fairspace-theme: | ||
needs: [generate-version] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.DOCKER_REGISTRY }} | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/keycloak-fairspace-theme | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./themes/ | ||
push: true | ||
tags: ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/keycloak-fairspace-theme:${{needs.generate-version.outputs.output1}} | ||
labels: ${{ steps.meta.outputs.labels }} |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
0.0.1 |