Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
Signed-off-by: Denis Neuling <[email protected]>
  • Loading branch information
denisneuling committed Mar 29, 2022
0 parents commit f03fd34
Show file tree
Hide file tree
Showing 45 changed files with 2,636 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
version: 2
updates:
-
package-ecosystem: "github-actions"
target-branch: develop
directory: "/"
labels:
- "dependabot"
- "github-actions"
schedule:
interval: "daily"
-
package-ecosystem: "docker"
target-branch: develop
directory: "edc-dataplane/src/main/docker"
labels:
- "dependabot"
- "docker"
schedule:
interval: "daily"
-
package-ecosystem: "docker"
target-branch: develop
directory: "edc-controlplane/edc-controlplane-cosmosdb/src/main/docker"
labels:
- "dependabot"
- "docker"
schedule:
interval: "daily"
-
package-ecosystem: "maven"
target-branch: develop
directory: "edc-controlplane/edc-controlplane-cosmosdb/src/main/docker"
labels:
- "dependabot"
- "dependencies"
schedule:
interval: "daily"

121 changes: 121 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
---
name: "Build"

on:
push:
branches:
- main
tags:
- '[0-9]+.[0-9]+.[0-9]+'
pull_request:
branches:
- '*'

jobs:
build:
runs-on: ubuntu-latest
steps:

##############
### Set-Up ###
##############
-
name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
-
name: Login to Github Packages
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CXNG_GHCR_PAT }}
-
name: Use specific edc version via git submodule # due to lack of release versions in maven central
run: |-
[ ! -d "edc" ] && git submodule add https://github.com/eclipse-dataspaceconnector/DataSpaceConnector.git edc
git submodule update --init
git -C edc checkout d429b6cd5e81e0fc79e8f9a0cb1b31888d0900a4
-
name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
cache: 'maven'
-
name: Build edc with Gradle to get latest snapshots
run: ./gradlew publishToMavenLocal
working-directory: edc

#################################
### edc-controlplane-cosmosdb ###
#################################
-
name: Build edc-controlplane-cosmosdb
run: |-
./mvnw -s settings.xml -B -pl .,edc-controlplane/edc-controlplane-cosmosdb -am verify
env:
GITHUB_PACKAGE_USERNAME: ${{ github.actor }}
GITHUB_PACKAGE_PASSWORD: ${{ secrets.CXNG_GHCR_PAT }}
-
name: Docker Metadata
id: edc_controlplane_cosmosdb_meta
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/catenax-ng/catena-x-edc/edc-controlplane-cosmosdb
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{raw}}
type=match,pattern=\d.\d.\d
type=sha
-
name: Build Docker Image
uses: docker/build-push-action@v2
with:
context: .
file: edc-controlplane/edc-controlplane-cosmosdb/src/main/docker/Dockerfile
build-args: |
JAR=edc-controlplane/edc-controlplane-cosmosdb/target/edc-controlplane-cosmosdb.jar
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.edc_controlplane_cosmosdb_meta.outputs.tags }}
labels: ${{ steps.edc_controlplane_cosmosdb_meta.outputs.labels }}

#####################
### edc-dataplane ###
#####################
-
name: Build edc-dataplane
run: |-
./mvnw -s settings.xml -B -pl .,edc-dataplane -am verify
env:
GITHUB_PACKAGE_USERNAME: ${{ github.actor }}
GITHUB_PACKAGE_PASSWORD: ${{ secrets.CXNG_GHCR_PAT }}
-
name: Docker Metadata
id: edc_dataplane_meta
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/catenax-ng/catena-x-edc/edc-dataplane
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{raw}}
type=match,pattern=\d.\d.\d
type=sha
-
name: Build Docker Image
uses: docker/build-push-action@v2
with:
context: .
file: edc-dataplane/src/main/docker/Dockerfile
build-args: |
JAR=edc-dataplane/target/edc-dataplane.jar
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.edc_dataplane_meta.outputs.tags }}
labels: ${{ steps.edc_dataplane_meta.outputs.labels }}
75 changes: 75 additions & 0 deletions .github/workflows/draft-new-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
name: "Draft new release"

on:
workflow_dispatch:
inputs:
version:
description: 'The version you want to release.'
required: true

jobs:
draft-new-release:
name: "Draft a new release"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
-
name: Create release branch
run: git checkout -b release/${{ github.event.inputs.version }}
-
name: Update changelog
uses: thomaseizinger/[email protected]
with:
tag: ${{ github.event.inputs.version }}
-
name: Initialize mandatory git config
run: |
git config user.name "GitHub actions"
git config user.email [email protected]
-
name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
cache: 'maven'
-
name: Bump version in pom.xml
run: |-
./mvnw -s settings.xml -B versions:set -DnewVersion=${{ github.event.inputs.version }} -DprocessAllModules
env:
GITHUB_PACKAGE_USERNAME: ${{ github.actor }}
GITHUB_PACKAGE_PASSWORD: ${{ secrets.CXNG_GHCR_PAT }}
-
name: Bump version in deployment/helm
uses: mikefarah/[email protected]
with:
cmd: |-
find deployment/helm -name Chart.yaml | xargs -n1 yq -i '.appVersion = "${{ github.event.inputs.version }}" | .version = "${{ github.event.inputs.version }}"'
-
name: Commit changelog and manifest files
id: make-commit
run: |
git add CHANGELOG.md $(find -name pom.xml) $(find deployment/helm -name Chart.yaml)
git commit --message "Prepare release ${{ github.event.inputs.version }}"
echo "::set-output name=commit::$(git rev-parse HEAD)"
-
name: Push new branch
run: git push origin release/${{ github.event.inputs.version }}
-
name: Create pull request
uses: thomaseizinger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
head: release/${{ github.event.inputs.version }}
base: main
title: Release version ${{ github.event.inputs.version }}
reviewers: ${{ github.actor }}
body: |-
This PR was created in response to a manual trigger of the [release workflow](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}).
The changelog was updated and versions have been bumped in [commit ${{ steps.make-commit.outputs.commit }}](${{ steps.make-commit.outputs.commit }}).
Merging this PR will create a GitHub release and upload any assets that are created as part of the release build.
95 changes: 95 additions & 0 deletions .github/workflows/publish-new-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
name: "Publish new release"

on:
pull_request:
branches:
- main
types:
- closed

jobs:
release:
name: Publish new release
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- uses: actions/checkout@v3
with:
# 0 to fetch the full history due to upcoming merge of main into develop branch
fetch-depth: 0
-
name: Extract version from branch name (for release branches)
if: startsWith(github.event.pull_request.head.ref, 'release/')
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
VERSION=${BRANCH_NAME#release/}
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
-
name: Extract version from branch name (for hotfix branches)
if: startsWith(github.event.pull_request.head.ref, 'hotfix/')
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
VERSION=${BRANCH_NAME#hotfix/}
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
-
name: Create Release Tag
run: |
# Prepare git env
git config user.name "GitHub actions"
git config user.email [email protected]
# informative
git branch -a
git tag
# Create & push tag
git tag --force ${{ env.RELEASE_VERSION }}
git push --force origin ${{ env.RELEASE_VERSION }}
-
name: Create Github Release
uses: thomaseizinger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
target_commitish: ${{ github.event.pull_request.merge_commit_sha }}
tag_name: ${{ env.RELEASE_VERSION }}
name: ${{ env.RELEASE_VERSION }}
draft: false
prerelease: false
-
name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
cache: 'maven'
-
name: Merge main back into develop and set new snapshot version
env:
GITHUB_PACKAGE_USERNAME: ${{ github.actor }}
GITHUB_PACKAGE_PASSWORD: ${{ secrets.CXNG_GHCR_PAT }}
run: |
# Prepare git env
git config user.name "GitHub actions"
git config user.email [email protected]
# Merge main into develop
git checkout develop && git merge -X theirs main --no-commit --no-ff
# Extract release version
IFS=. read -r RELEASE_VERSION_MAJOR RELEASE_VERSION_MINOR RELEASE_VERSION_PATCH<<<"${{ env.RELEASE_VERSION }}"
# Compute new snapshot version
VERSION="$RELEASE_VERSION_MAJOR.$RELEASE_VERSION_MINOR.$((RELEASE_VERSION_PATCH+1))-SNAPSHOT"
SNAPSHOT_VERSION=$VERSION
# Persist new version into each pom
./mvnw -s settings.xml -B versions:set -DnewVersion="$SNAPSHOT_VERSION" -DprocessAllModules
# Commit and push to origin develop
git add $(find -name pom.xml)
git commit --message "Introduce new snapshot version $SNAPSHOT_VERSION"
git push origin develop
Loading

0 comments on commit f03fd34

Please sign in to comment.