Run continuous-integration tasks for Keycloak #4
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: CI - keycloak | |
run-name: Run continuous-integration tasks for Keycloak | |
on: | |
push: | |
paths: | |
- 'keycloak/**' | |
branches: | |
- 'keycloak' | |
tags: | |
- '0.*' | |
- '1.*' | |
jobs: | |
build_image: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- run: >- | |
sed -n -E 's/^FROM[[:space:]]+quay.io[/]keycloak[/]keycloak:([0-9]+([.][0-9]+){1,2})/\1/p' keycloak/keycloak/Dockerfile | |
| tee keycloak-version | |
- run: |- | |
echo keycloak_version="$(< keycloak-version)" >> $GITHUB_ENV | |
echo keycloak_major_version="$(sed -n -E 's/^([0-9]+)[.].*/\1/p' keycloak-version)" >> $GITHUB_ENV | |
- run: env | sort | |
- run: echo ${{ env.keycloak_version }} | |
- uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: docker/metadata-action@v4 | |
id: meta | |
with: | |
images: | | |
ghcr.io/opertusmundi/keycloak | |
- uses: docker/setup-buildx-action@v2 | |
- name: >- | |
Build Keycloak image (JGroups discovery mechanism: UDP multicast) | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./keycloak/keycloak | |
file: keycloak/keycloak/Dockerfile | |
build-args: | | |
kc_cache_stack=udp | |
push: true | |
tags: | | |
ghcr.io/opertusmundi/keycloak:${{ github.ref_name }}-${{ env.keycloak_version }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: >- | |
Build Keycloak image (JGroups discovery mechanism: DNS_PING) | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./keycloak/keycloak | |
file: keycloak/keycloak/Dockerfile | |
build-args: | | |
kc_cache_stack=kubernetes | |
push: true | |
tags: | | |
ghcr.io/opertusmundi/keycloak:${{ github.ref_name }}-${{ env.keycloak_version }}-on-kubernetes | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |