Skip to content

Commit

Permalink
Merge branch 'main' into readme-update
Browse files Browse the repository at this point in the history
  • Loading branch information
taminobaumann authored Jan 15, 2025
2 parents c811264 + efe61c6 commit 3f8100c
Show file tree
Hide file tree
Showing 22 changed files with 616 additions and 518 deletions.
107 changes: 58 additions & 49 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,69 @@
name: Build docker on every push except main branch
name: Build and/or push docker (reusable workflow)

on:
push:
branches-ignore:
- main
workflow_call:
inputs:
version:
description: "release version"
required: true
type: string
tag:
description: "desired tag, e.g. latest, dev (defaults to dev)"
required: false
type: string
default: "dev"
publish:
description: "Specifies whether to publish the images (defaults to false)"
required: false
type: boolean
default: false


jobs:
build:
name: "Build"
runs-on: "ubuntu-latest"
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
services:
- {
folder: waltid-services/waltid-issuer-api,
image: issuer-api
}
- {
folder: waltid-services/waltid-verifier-api,
image: verifier-api
}
- {
folder: waltid-services/waltid-wallet-api,
image: wallet-api
}
- {
folder: waltid-applications/waltid-web-wallet/apps/waltid-demo-wallet,
image: waltid-demo-wallet
}
- {
folder: waltid-applications/waltid-web-wallet/apps/waltid-dev-wallet,
image: waltid-dev-wallet
}
- {
folder: waltid-applications/waltid-web-portal,
image: portal
}
steps:
- uses: actions/checkout@v3
- name: Setup cache
uses: actions/cache@v4
- name: Login to Docker Hub
if: ${{ inputs.publish }}
uses: docker/login-action@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build and push Docker images (issuer)
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Docker Buildx
if: ${{ !inputs.publish }}
uses: docker/setup-buildx-action@v2
- name: Build and push Docker images (${{ matrix.services.image }})
uses: docker/build-push-action@v6
with:
push: false
file: waltid-services/waltid-issuer-api/Dockerfile
#tags: waltid/issuer-api:latest, waltid/issuer-api:${{ env.release_version }}
- name: Build and push Docker images (verifier)
uses: docker/build-push-action@v6
with:
push: false
file: waltid-services/waltid-verifier-api/Dockerfile
#tags: waltid/verifier-api:latest, waltid/verifier-api:${{ env.release_version }}
- name: Build and push Docker images (wallet-api)
uses: docker/build-push-action@v6
with:
push: false
file: waltid-services/waltid-wallet-api/Dockerfile
#tags: waltid/wallet-api:latest, waltid/wallet-api:${{ env.release_version }}
- name: Build and push Docker images (waltid-dev-wallet)
uses: docker/build-push-action@v6
with:
push: false
file: waltid-applications/waltid-web-wallet/apps/waltid-dev-wallet/Dockerfile
#tags: waltid/waltid-dev-wallet:latest, waltid/waltid-dev-wallet:${{ env.release_version }}
- name: Build and push Docker images (waltid-demo-wallet)
uses: docker/build-push-action@v6
with:
push: false
file: waltid-applications/waltid-web-wallet/apps/waltid-demo-wallet/Dockerfile
#tags: waltid/waltid-demo-wallet:latest, waltid/waltid-demo-wallet:${{ env.release_version }}
- name: Build and push Docker images (wallet-portal)
uses: docker/build-push-action@v6
with:
push: false
file: waltid-applications/waltid-web-portal/Dockerfile
#tags: waltid/portal:latest, waltid/portal:${{ env.release_version }}

push: ${{ inputs.publish }}
file: ${{ matrix.services.folder }}/Dockerfile
tags: waltid/${{ matrix.services.image }}:${{ inputs.tag }}, waltid/${{ matrix.services.image }}:${{ inputs.version }}
60 changes: 60 additions & 0 deletions .github/workflows/build-gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Build gradle and/or publish (reusable workflow)

on:
workflow_call:
inputs:
version:
description: "release version"
required: true
type: string
publish:
description: "Specifies whether to publish the artifacts (defaults to false)"
required: false
type: boolean
default: false

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/[email protected]
with:
tool-cache: false
docker-images: false
- uses: actions/checkout@v3
- name: Set version
run: |
sed -i "s/1.0.0-SNAPSHOT/${{ inputs.version }}/g" build.gradle.kts
- name: Setup cache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Gradle wrapper validation
uses: gradle/wrapper-validation-action@v3
- name: Set gradle build publish arguments
id: publish-arguments
run: |
if [ "${{ inputs.publish }}" == "true" ]; then
echo "arguments=publish" >> $GITHUB_OUTPUT
else
echo "arguments=" >> $GITHUB_OUTPUT
fi
- name: Running gradle build
uses: eskatos/gradle-command-action@v3
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
with:
arguments: build ${{ steps.publish-arguments.outputs.arguments }} --no-daemon
51 changes: 12 additions & 39 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,16 @@ on:
branches-ignore:
- main


jobs:
build:
name: "Build"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v3
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Setup cache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Gradle wrapper validation
uses: gradle/wrapper-validation-action@v3

- name: Get changed files in the frontend
id: frontend-changed-files
uses: tj-actions/changed-files@v45
with:
files: |
waltid-applications/waltid-web-portal/**
waltid-applications/waltid-web-wallet/web/**
- name: Running gradle build
uses: eskatos/gradle-command-action@v3
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
with:
arguments: build --no-daemon
if: ${{ steps.frontend-changed-files.outputs.any_changed == 'false' }}
version:
uses: walt-id/waltid-identity/.github/workflows/version.yml@c69d2155372700071dad887fa6339b51e0266be5
gradle-build:
uses: walt-id/waltid-identity/.github/workflows/build-gradle.yml@c69d2155372700071dad887fa6339b51e0266be5
needs: version
with:
version: ${{ needs.version.outputs.release_version }}
docker-build:
uses: walt-id/waltid-identity/.github/workflows/build-docker.yml@c69d2155372700071dad887fa6339b51e0266be5
needs: version
with:
version: ${{ needs.version.outputs.release_version }}
39 changes: 39 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Create changelog with tag (reusable workflow)

on:
workflow_call:
inputs:
version:
description: "release version"
required: true
type: string

jobs:
build:
name: Create
runs-on: ubuntu-latest
steps:
- run: |
git tag v${{ inputs.version }}
git push --tags
- name: Changelog
uses: ardalanamini/auto-changelog@v4
id: changelog
with:
github-token: ${{ github.token }}
default-commit-type: Other Changes
release-name: v${{ inputs.version }}
mention-authors: true
mention-new-contributors: true
include-compare-link: true
use-github-autolink: true
semver: true
- name: Create Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ inputs.version }}
# body: |
# ${{ steps.changelog.outputs.changelog }}
prerelease: ${{ steps.changelog.outputs.prerelease }}
56 changes: 56 additions & 0 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Deploy to environment (reusable workflow)

on:
workflow_call:
inputs:
version:
description: "release version"
required: true
type: string
deployment:
description: "deployment file suffix (defaults to dev)"
required: false
type: string
default: "dev"
namespace:
description: "deployment namespace (defaults to dev)"
required: false
type: string
default: "dev"
portals:
description: "deployment namespace for portal related services (defaults to dev)"
required: false
type: string
default: "dev"

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
env:
IMAGE_TAG: ${{ inputs.version }}
PORTALS: ${{ inputs.portals }}
NAMESPACE: ${{ inputs.namespace }}
KEYCLOAK: ${{ secrets.DEV_KEYCLOAK_CLIENT_SECRET }}
strategy:
matrix:
services: [
{ kube: waltid-services/waltid-issuer-api/k8s, name: issuer, namespace: $PORTALS },
{ kube: waltid-services/waltid-verifier-api/k8s, name: verifier, namespace: $PORTALS },
{ kube: waltid-services/waltid-wallet-api/k8s, name: web-wallet, namespace: $NAMESPACE, keycloak: $KEYCLOAK },
{ kube: waltid-applications/waltid-web-portal/k8s, name: portal, namespace: $PORTALS }
]
steps:
- name: Prepare CD - ${{ matrix.services.name }}
run: |
sed "s/_DEFAULT_DEPLOYMENT_/$GITHUB_SHA/g" ${{ matrix.services.kube }}/deployment-${{ inputs.deployment }}.yaml > ${{ matrix.services.kube }}/deployment_mod.yaml |
sed "s/__DEFAULT_IMAGE_TAG__/$IMAGE_TAG/g" > ${{ matrix.services.kube }}/deployment_mod.yaml |
if [ "${{ matrix.services.keycloak }}" != "" ]; then
sed "s/__DEFAULT_KEYCLOAK_CLIENT_SECRET__/${{ matrix.services.keycloak }}/g" > ${{ matrix.services.kube }}/deployment_mod.yaml
fi
- name: Continuous deployment - ${{ matrix.services.name }}
uses: actions-hub/kubectl@master
env:
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
with:
args: apply -n ${{ matrix.services.namespace }} -f ${{ matrix.services.kube }}/deployment_mod.yaml
Loading

0 comments on commit 3f8100c

Please sign in to comment.