Skip to content

Commit

Permalink
feat: add release pipline with build and publish trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
dhommen committed Jan 25, 2024
1 parent 7f6dea9 commit 83bcd01
Show file tree
Hide file tree
Showing 9 changed files with 6,429 additions and 647 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
name: Build and Publish EDC Extension
name: Build and Test
on:
push:
branches: ["main"]
paths: ["logging-house-client/**/*"]
pull_request:
branches: ["main"]

Expand All @@ -11,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
packages: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
Expand All @@ -21,15 +18,6 @@ jobs:
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@ccb4328a959376b642e027874838f60f8e596de3
- name: Build package
if: ${{ github.ref != 'refs/heads/main' }}
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629
with:
arguments: build
- name: Publish package
if: ${{ github.ref == 'refs/heads/main' }}
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629
with:
arguments: publish
env:
USERNAME: ${{ github.actor }}
TOKEN: ${{ github.token }}
47 changes: 0 additions & 47 deletions .github/workflows/publish-server.yml

This file was deleted.

78 changes: 78 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Build and Publish

on:
release:
types: [published]

env:
REGISTRY: ghcr.io/truzzt/mds-ap3
DOCKER_USERNAME: ${{ github.actor }}
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
IMAGE_TAG: ${{ github.event.release.name }}

jobs:
build-and-publish-server:
runs-on: ubuntu-latest
strategy:
matrix:
component: ['app', 'edc']

permissions:
contents: read
packages: write
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Login to GitHub Container Registry
run: echo $DOCKER_PASSWORD | docker login $REGISTRY -u $DOCKER_USERNAME --password-stdin

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build and Push Docker image
run: |
cd logging-house-server/${{ matrix.component }}
docker build -t $REGISTRY/${{ matrix.component }}:$IMAGE_TAG .
docker push $REGISTRY/${{ matrix.component }}:$IMAGE_TAG
with:
context: .
file: ./Dockerfile
push: true
tags: $REGISTRY/${{ matrix.component }}:$IMAGE_TAG
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache


build-and-publish-edc-extension:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@ccb4328a959376b642e027874838f60f8e596de3
- name: Publish
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629
with:
arguments: -Pversion=$IMAGE_TAG publish
env:
USERNAME: ${{ github.actor }}
TOKEN: ${{ github.token }}

26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Release
on:
push:
branches:
- master
- alpha
- beta

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 18
- name: Install dependencies
run: npm ci
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release
10 changes: 10 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"branches": ["+([0-9])?(.{+([0-9]),x}).x", "main", {"name": "beta", "prerelease": true}, {"name": "alpha", "prerelease": true}],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/git",
"@semantic-release/github"
]
}
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ subprojects {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/truzzt/mds-ap3")
version = "0.1.1"
credentials {
username = System.getenv("USERNAME")
password = System.getenv("TOKEN")
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ jettyGroup=org.eclipse.jetty
jettyVersion=11.0.15

org.gradle.jvmargs=-Xmx1024m
version=0.1.1
Loading

0 comments on commit 83bcd01

Please sign in to comment.