Skip to content

Build and Deploy EDC #4

Build and Deploy EDC

Build and Deploy EDC #4

name: Build and Deploy EDC
on:
# pull_request:
# types:
# - opened
# - reopened
# - review_requested
# push:
# branches: ["main"]
workflow_dispatch:
env:
REGISTRY: ghcr.io
NAMESPACE: possible-x
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v2
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.NAMESPACE }}/connector
tags: |
type=raw,value=latest,enable={{is_default_branch}}
${{ github.sha }}
#
# - uses: sigstore/cosign-installer@main
#
# - name: Write signing key to disk
# run: echo "${{ secrets.SIGNING_SECRET }}" > cosign.key
#
- 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 }}
# - name: Sign "connector" image
# run: |
# cosign sign -y --key cosign.key \
# ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/connector@${{ steps.build_and_push_connector.outputs.digest }}
# env:
# COSIGN_PASSWORD: ${{ secrets.SIGNING_SECRET_PASSWORD }}
deployment:
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/${{vars.PROVIDER_DEPLOYMENT_NAME}} -n ${{ vars.PROVIDER_NS }} possible-x-edc=${{ env.REGISTRY }}/possible-x/connector:${{ github.sha }} "
- name: 'Invoke Kubectl Consumer'
uses: actions-hub/kubectl@master
env:
KUBE_CONFIG: ${{ secrets.KUBECONFIG }}
with:
args: "set image deployment/${{vars.CONSUMER_DEPLOYMENT_NAME}} -n ${{ vars.CONSUMER_NS }} possible-x-edc=${{ env.REGISTRY }}/possible-x/connector:${{ github.sha }} "