WIP: revert changes entirely #86
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: Build and upload | |
on: [ push ] | |
env: | |
DEFAULT_JDK_VERSION: 17 | |
DEFAULT_JDK_DIST: temurin | |
concurrency: | |
# Only run once for latest commit per ref and cancel other (previous) runs. | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
maven-build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ env.DEFAULT_JDK_VERSION }} | |
distribution: ${{ env.DEFAULT_JDK_DIST }} | |
- name: Build Keycloak | |
run: mvn clean install -Pdistribution -DskipTests -DskipExamples -DskipTestsuite | |
- name: Upload Keycloak artifact | |
id: store-keycloak | |
uses: actions/upload-artifact@v4 | |
with: | |
name: keycloak-distribution-${{ github.sha }} | |
retention-days: 1 | |
path: quarkus/dist/target/keycloak*.tar.gz | |
image-build: | |
runs-on: ubuntu-latest | |
needs: | |
- maven-build | |
env: | |
DOCKER_WORKING_DIR: ${{ github.workspace }}/quarkus/container | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download Keycloak distribution | |
uses: actions/download-artifact@v4 | |
with: | |
name: keycloak-distribution-${{ github.sha }} | |
path: ${{ env.DOCKER_WORKING_DIR }} | |
- uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ vars.ECR_PUBLIC_REGION }} | |
- id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v2 | |
with: | |
registry-type: public | |
- uses: docker/setup-buildx-action@v3 | |
- uses: docker/setup-qemu-action@v3 | |
- name: Set variables | |
id: set-variables | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
run: | | |
export KEYCLOAK_REPOSITORY=$ECR_REGISTRY/moneymeets/keycloak | |
if [[ "${{ github.ref }}" == "refs/heads/moneymeets/22.0.4" ]]; then | |
export IMAGE_TAG=$KEYCLOAK_REPOSITORY:${GITHUB_REF_NAME##moneymeets/}-${GITHUB_SHA} | |
else | |
# Replace / with - because of allowed charactes in docker image tags ('feature/test-1' to 'feature-test-1') | |
export IMAGE_TAG=$KEYCLOAK_REPOSITORY:$(echo ${GITHUB_REF_NAME} | awk '{print tolower($0)}' | sed -e 's|/|-|') | |
fi | |
echo "image-url-with-tag=${IMAGE_TAG}" >> $GITHUB_OUTPUT | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
env: | |
IMAGE_URL_WITH_TAG: ${{ steps.set-variables.outputs.image-url-with-tag }} | |
with: | |
context: ${{ env.DOCKER_WORKING_DIR }} | |
push: true | |
tags: ${{ env.IMAGE_URL_WITH_TAG }} | |
platforms: linux/amd64,linux/arm64 |