Merge pull request #24 from POSSIBLE-X/readme-update #80
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
# Copyright 2024-2025 Dataport. All rights reserved. Developed as part of the POSSIBLE project. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
name: Build and Deploy EDC to Cluster | |
on: | |
push: | |
branches: ["develop", "main"] | |
workflow_dispatch: | |
env: | |
REGISTRY: ghcr.io | |
REGISTRY_NAMESPACE: possible-x | |
K8S_NAMESPACE: ${{ github.ref == 'refs/heads/main' && 'mvd-001-demo' || 'edc-dev' }} | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: postgres | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
services: | |
postgres: | |
image: postgres:16 | |
env: | |
POSTGRES_USER: ${{ env.POSTGRES_USER }} | |
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }} | |
POSTGRES_DB: ${{ env.POSTGRES_DB }} | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
buildkitd-flags: --debug | |
- name: Prepare required files | |
env: | |
USERNAME_GITHUB: ${{ github.actor }} | |
TOKEN_GITHUB: ${{ secrets.GITHUB_TOKEN }} | |
run: sh ./gradlew clean build | |
- name: Docker "connector" meta | |
id: connector-meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.REGISTRY_NAMESPACE }}/connector | |
tags: | | |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main'}} | |
type=raw,value=latest-${{github.ref_name }},enable=${{ github.ref != 'refs/heads/main'}} | |
${{ github.sha }} | |
- name: Build and push "connector" | |
id: build_and_push_connector | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./connector | |
file: ./connector/Dockerfile | |
push: true | |
tags: ${{ steps.connector-meta.outputs.tags }} | |
labels: ${{ steps.connector-meta.outputs.labels }} | |
deploy-consumer: | |
runs-on: 'ubuntu-latest' | |
needs: build-and-push-image | |
steps: | |
- name: 'Invoke Kubectl Consumer' | |
uses: actions-hub/kubectl@master | |
env: | |
KUBE_CONFIG: ${{ secrets.KUBECONFIG }} | |
with: | |
args: "set image deployment/consumer-edc-possible-x-edc -n ${{ env.K8S_NAMESPACE }} possible-x-edc=${{ env.REGISTRY }}/${{ env.REGISTRY_NAMESPACE }}/connector:${{ github.sha }} " | |
deploy-provider: | |
runs-on: 'ubuntu-latest' | |
needs: build-and-push-image | |
steps: | |
- name: 'Invoke Kubectl Provider' | |
uses: actions-hub/kubectl@master | |
env: | |
KUBE_CONFIG: ${{ secrets.KUBECONFIG }} | |
with: | |
args: "set image deployment/provider-edc-possible-x-edc -n ${{ env.K8S_NAMESPACE }} possible-x-edc=${{ env.REGISTRY }}/${{ env.REGISTRY_NAMESPACE }}/connector:${{ github.sha }} " |