Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moneymeets/adjust for keycloak 22 #11

Merged
merged 12 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/actions/build-keycloak/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ runs:
# By using "dependency:resolve", it will download all dependencies used in later stages for running the tests
run: |
MVN_HTTP_CONFIG="-Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120"
./mvnw install dependency:resolve -nsu -V -B -e -DskipTests -DskipExamples $MVN_HTTP_CONFIG ${{ env.MVN_PROFILES}}
MVN_PROFILES="-Pdistribution"
./mvnw install dependency:resolve -nsu -V -B -e -DskipTests -DskipExamples -DskipTestsuite $MVN_HTTP_CONFIG $MVN_PROFILES

- id: compress-keycloak-maven-repository
name: Compress Keycloak Maven artifacts
Expand Down
92 changes: 92 additions & 0 deletions .github/workflows/build-and-upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
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
Loading