Skip to content

Commit 6da648d

Browse files
committed
chore(project): Update project configuration and add Docker publishing workflow
1 parent 426410c commit 6da648d

File tree

13 files changed

+6851
-85
lines changed

13 files changed

+6851
-85
lines changed

.github/workflows/build-pr.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,27 @@ jobs:
1212
matrix:
1313
os: [ubuntu-latest, windows-latest, macos-latest]
1414
steps:
15-
- name: Checkout repository
15+
- name: Checkout Repository
1616
uses: actions/checkout@v4
1717
- name: Setup Java
1818
uses: actions/setup-java@v4
1919
with:
2020
distribution: temurin
21-
java-version: 21
21+
java-version: 24
22+
- name: Setup Gradle
23+
uses: gradle/actions/setup-gradle@v4
2224
- name: Build on ${{ matrix.os }}
23-
run: ./gradlew clean build
25+
run: ./gradlew clean build test
26+
# - name: Generate JaCoCo Coverage Report
27+
# if: matrix.os == 'ubuntu-latest'
28+
# run: ./gradlew jacocoTestReport
29+
# - name: Jacoco Report to PR
30+
# id: jacoco
31+
# uses: madrapps/jacoco-report@v1.7.2
32+
# with:
33+
# paths: ${{ github.workspace }}/build/reports/jacoco/test/jacocoTestReport.xml
34+
# token: ${{ secrets.GITHUB_TOKEN }}
35+
# min-coverage-overall: 40
36+
# min-coverage-changed-files: 60
37+
# title: Code Coverage
38+
# update-comment: true

.github/workflows/close_invalid_prs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ on:
66

77
jobs:
88
run:
9-
if: ${{ github.repository != github.event.pull_request.head.repo.full_name && github.head_ref == 'develop' }}
9+
if: ${{ github.repository != github.event.pull_request.head.repo.full_name && github.head_ref == 'main' }}
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: superbrothers/close-pull-request@v3
1313
with:
14-
comment: "Please do not open pull requests from the `develop` branch, create a new branch instead."
14+
comment: "Please do not open pull requests from the `main` branch, create a new branch instead."

.github/workflows/main-build.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 121 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,130 @@
1-
name: Publish JAR
1+
name: Publish Docker Images
22

33
on:
44
push:
5-
branches:
6-
- master
7-
- develop
5+
tags:
6+
- "v*.*.*"
7+
88
jobs:
9-
build:
9+
gradle:
1010
runs-on: ubuntu-latest
11-
env:
12-
ONELITEFEATHER_MAVEN_USERNAME: ${{ secrets.ONELITEFEATHER_MAVEN_USERNAME }}
13-
ONELITEFEATHER_MAVEN_PASSWORD: ${{ secrets.ONELITEFEATHER_MAVEN_PASSWORD }}
1411
steps:
15-
- name: Checkout repository
12+
- name: Checkout
1613
uses: actions/checkout@v4
17-
- name: Set up JDK 21
14+
with:
15+
fetch-depth: 0
16+
- name: Validate Gradle Wrapper
17+
uses: gradle/actions/wrapper-validation@v4
18+
- name: Setup Java
1819
uses: actions/setup-java@v4
1920
with:
20-
distribution: 'temurin'
21-
java-version: '21'
22-
- name: Build with Gradle
23-
run: ./gradlew build
24-
- name: Publish to Maven
25-
run: ./gradlew publish
21+
distribution: temurin
22+
java-version: 24
23+
- name: Setup Gradle
24+
uses: gradle/actions/setup-gradle@v4
25+
- name: Build on ${{ matrix.os }}
26+
run: ./gradlew optimizedDockerfile optimizedDockerfileNative optimizedBuildLayers optimizedBuildNativeLayersTask
27+
- name: Upload build artifacts
28+
uses: actions/upload-artifact@v4
29+
with:
30+
name: build
31+
path: backend/build
32+
33+
dockerNative:
34+
runs-on: ubuntu-latest
35+
needs:
36+
- gradle
37+
steps:
38+
- uses: actions/checkout@v4
39+
name: Checkout
40+
- name: Download build artifacts
41+
uses: actions/download-artifact@v5
42+
with:
43+
name: build
44+
path: backend/build
45+
- name: Docker meta
46+
id: meta
47+
uses: docker/metadata-action@v5
48+
with:
49+
# list of Docker images to use as base name for tags
50+
images: |
51+
${{ secrets.HARBOR_REGISTRY }}/otis/otis-native
52+
# generate Docker tags based on the following events/attributes
53+
tags: |
54+
type=schedule
55+
type=ref,event=branch
56+
type=ref,event=pr
57+
type=semver,pattern={{version}}
58+
type=semver,pattern={{major}}.{{minor}}
59+
type=semver,pattern={{major}}
60+
type=sha
61+
- name: Log in to OneLiteFeather Harbor
62+
if: github.event_name != 'pull_request'
63+
uses: docker/login-action@v3
64+
with:
65+
username: ${{ secrets.HARBOR_USERNAME }}
66+
password: ${{ secrets.HARBOR_PASSWORD }}
67+
registry: ${{ secrets.HARBOR_REGISTRY }}
68+
69+
- name: Set up QEMU
70+
uses: docker/setup-qemu-action@v3
71+
72+
- name: Set up Docker Buildx
73+
uses: docker/setup-buildx-action@v3
74+
75+
- name: Build and push
76+
uses: docker/build-push-action@v6
77+
with:
78+
push: ${{ github.event_name != 'pull_request' }}
79+
tags: ${{ steps.meta.outputs.tags }}
80+
labels: ${{ steps.meta.outputs.labels }}
81+
context: ./backend/build/docker/native-optimized
82+
docker:
83+
runs-on: ubuntu-latest
84+
needs:
85+
- gradle
86+
steps:
87+
- uses: actions/checkout@v4
88+
name: Checkout
89+
- name: Download build artifacts
90+
uses: actions/download-artifact@v5
91+
with:
92+
name: build
93+
path: backend/build
94+
- name: Docker meta
95+
id: meta
96+
uses: docker/metadata-action@v5
97+
with:
98+
# list of Docker images to use as base name for tags
99+
images: |
100+
${{ secrets.HARBOR_REGISTRY }}/otis/otis
101+
# generate Docker tags based on the following events/attributes
102+
tags: |
103+
type=schedule
104+
type=ref,event=branch
105+
type=ref,event=pr
106+
type=semver,pattern={{version}}
107+
type=semver,pattern={{major}}.{{minor}}
108+
type=semver,pattern={{major}}
109+
type=sha
110+
- name: Log in to OneLiteFeather Harbor
111+
if: github.event_name != 'pull_request'
112+
uses: docker/login-action@v3
113+
with:
114+
username: ${{ secrets.HARBOR_USERNAME }}
115+
password: ${{ secrets.HARBOR_PASSWORD }}
116+
registry: ${{ secrets.HARBOR_REGISTRY }}
117+
118+
- name: Set up QEMU
119+
uses: docker/setup-qemu-action@v3
120+
121+
- name: Set up Docker Buildx
122+
uses: docker/setup-buildx-action@v3
123+
124+
- name: Build and push
125+
uses: docker/build-push-action@v6
126+
with:
127+
push: ${{ github.event_name != 'pull_request' }}
128+
tags: ${{ steps.meta.outputs.tags }}
129+
labels: ${{ steps.meta.outputs.labels }}
130+
context: ./backend/build/docker/optimized
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Release
2+
"on":
3+
push:
4+
branches:
5+
- main
6+
- next
7+
- beta
8+
- "*.x"
9+
10+
permissions:
11+
contents: read # for checkout
12+
13+
jobs:
14+
release:
15+
name: Release
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: write # to be able to publish a GitHub release
19+
issues: write # to be able to comment on released issues
20+
pull-requests: write # to be able to comment on released pull requests
21+
id-token: write # to enable use of OIDC for npm provenance
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
- name: Setup Node.js
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: "lts/*"
31+
- name: Validate Gradle Wrapper
32+
uses: gradle/actions/wrapper-validation@v4
33+
- name: Setup Java
34+
uses: actions/setup-java@v4
35+
with:
36+
distribution: temurin
37+
java-version: 24
38+
- name: Setup Gradle
39+
uses: gradle/actions/setup-gradle@v4
40+
- name: Install dependencies
41+
run: npm clean-install
42+
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
43+
run: npm audit signatures
44+
- name: Release
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
48+
ONELITEFEATHER_MAVEN_USERNAME: ${{ secrets.ONELITEFEATHER_MAVEN_USERNAME }}
49+
ONELITEFEATHER_MAVEN_PASSWORD: ${{ secrets.ONELITEFEATHER_MAVEN_PASSWORD }}
50+
run: npx semantic-release

.releaserc.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"plugins": [
3+
[
4+
"@semantic-release/commit-analyzer",
5+
{
6+
"preset": "conventionalcommits"
7+
}
8+
],
9+
"@semantic-release/release-notes-generator",
10+
[
11+
"@semantic-release/exec",
12+
{
13+
"verifyConditionsCmd": "./gradlew check",
14+
"publishCmd": "./gradlew -Pversion=${nextRelease.version} publish"
15+
}
16+
],
17+
"@semantic-release/git",
18+
[
19+
"@semantic-release/github",
20+
{
21+
"assets": [],
22+
"labels": false,
23+
"failTitle": false,
24+
"failComment": false,
25+
"successComment": false,
26+
"releasedLabels": false,
27+
"addReleases": false
28+
}
29+
]
30+
]
31+
}

backend/build.gradle.kts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@ plugins {
22
alias(libs.plugins.micronaut.application)
33
alias(libs.plugins.micronaut.aot)
44
}
5-
6-
version = "0.1"
7-
group = "net.onelitefeather"
8-
9-
repositories {
10-
mavenCentral()
11-
}
12-
135
dependencies {
146
annotationProcessor(mn.micronaut.serde.processor)
157
annotationProcessor(mn.micronaut.http.validation)

0 commit comments

Comments
 (0)