Skip to content

Commit 85ec5a6

Browse files
committed
feat(release): Enhance release workflow to output version and build Docker artifacts
1 parent df849b5 commit 85ec5a6

File tree

3 files changed

+113
-135
lines changed

3 files changed

+113
-135
lines changed

.github/workflows/publish.yml

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

.github/workflows/sematic-releases.yml

Lines changed: 112 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
issues: write # to be able to comment on released issues
2020
pull-requests: write # to be able to comment on released pull requests
2121
id-token: write # to enable use of OIDC for npm provenance
22+
outputs:
23+
release_version: ${{ steps.get_version.outputs.release_version }}
2224
steps:
2325
- name: Checkout
2426
uses: actions/checkout@v4
@@ -47,4 +49,113 @@ jobs:
4749
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4850
ONELITEFEATHER_MAVEN_USERNAME: ${{ secrets.ONELITEFEATHER_MAVEN_USERNAME }}
4951
ONELITEFEATHER_MAVEN_PASSWORD: ${{ secrets.ONELITEFEATHER_MAVEN_PASSWORD }}
50-
run: npx semantic-release
52+
run: npx semantic-release
53+
- name: Get release version
54+
id: get_version
55+
run: |
56+
if [ -f version.txt ]; then
57+
VERSION=$(cat version.txt)
58+
echo "release_version=$VERSION" >> $GITHUB_OUTPUT
59+
fi
60+
gradle:
61+
name: Build Docker Artifacts
62+
runs-on: ubuntu-latest
63+
needs: release
64+
if: needs.release.outputs.release_version != ''
65+
steps:
66+
- name: Checkout
67+
uses: actions/checkout@v4
68+
with:
69+
fetch-depth: 0
70+
- name: Validate Gradle Wrapper
71+
uses: gradle/actions/wrapper-validation@v4
72+
- name: Setup Java
73+
uses: actions/setup-java@v4
74+
with:
75+
distribution: temurin
76+
java-version: 24
77+
- name: Setup Gradle
78+
uses: gradle/actions/setup-gradle@v4
79+
- name: Build Docker Artifacts
80+
run: ./gradlew optimizedDockerfile optimizedDockerfileNative optimizedBuildLayers optimizedBuildNativeLayersTask
81+
- name: Upload build artifacts
82+
uses: actions/upload-artifact@v4
83+
with:
84+
name: build
85+
path: backend/build
86+
87+
dockerNative:
88+
runs-on: ubuntu-latest
89+
needs: gradle
90+
steps:
91+
- uses: actions/checkout@v4
92+
- name: Download build artifacts
93+
uses: actions/download-artifact@v5
94+
with:
95+
name: build
96+
path: backend/build
97+
- name: Docker meta
98+
id: meta
99+
uses: docker/metadata-action@v5
100+
with:
101+
images: |
102+
${{ secrets.HARBOR_REGISTRY }}/otis/otis-native
103+
tags: |
104+
type=semver,pattern={{version}},value=${{ needs.release.outputs.release_version }}
105+
type=semver,pattern={{major}}.{{minor}},value=${{ needs.release.outputs.release_version }}
106+
type=semver,pattern={{major}},value=${{ needs.release.outputs.release_version }}
107+
- name: Log in to OneLiteFeather Harbor
108+
uses: docker/login-action@v3
109+
with:
110+
username: ${{ secrets.HARBOR_USERNAME }}
111+
password: ${{ secrets.HARBOR_PASSWORD }}
112+
registry: ${{ secrets.HARBOR_REGISTRY }}
113+
- name: Set up QEMU
114+
uses: docker/setup-qemu-action@v3
115+
- name: Set up Docker Buildx
116+
uses: docker/setup-buildx-action@v3
117+
- name: Build and push
118+
uses: docker/build-push-action@v6
119+
with:
120+
push: true
121+
tags: ${{ steps.meta.outputs.tags }}
122+
labels: ${{ steps.meta.outputs.labels }}
123+
context: ./backend/build/docker/native-optimized
124+
125+
docker:
126+
runs-on: ubuntu-latest
127+
needs: gradle
128+
steps:
129+
- uses: actions/checkout@v4
130+
- name: Download build artifacts
131+
uses: actions/download-artifact@v5
132+
with:
133+
name: build
134+
path: backend/build
135+
- name: Docker meta
136+
id: meta
137+
uses: docker/metadata-action@v5
138+
with:
139+
images: |
140+
${{ secrets.HARBOR_REGISTRY }}/otis/otis
141+
tags: |
142+
type=semver,pattern={{version}},value=${{ needs.release.outputs.release_version }}
143+
type=semver,pattern={{major}}.{{minor}},value=${{ needs.release.outputs.release_version }}
144+
type=semver,pattern={{major}},value=${{ needs.release.outputs.release_version }}
145+
- name: Log in to OneLiteFeather Harbor
146+
uses: docker/login-action@v3
147+
with:
148+
username: ${{ secrets.HARBOR_USERNAME }}
149+
password: ${{ secrets.HARBOR_PASSWORD }}
150+
registry: ${{ secrets.HARBOR_REGISTRY }}
151+
- name: Set up QEMU
152+
uses: docker/setup-qemu-action@v3
153+
- name: Set up Docker Buildx
154+
uses: docker/setup-buildx-action@v3
155+
- name: Build and push
156+
uses: docker/build-push-action@v6
157+
with:
158+
push: true
159+
tags: ${{ steps.meta.outputs.tags }}
160+
labels: ${{ steps.meta.outputs.labels }}
161+
context: ./backend/build/docker/optimized

.releaserc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"@semantic-release/exec",
1212
{
1313
"verifyConditionsCmd": "./gradlew check",
14-
"publishCmd": "./gradlew -Pversion=${nextRelease.version} publish"
14+
"publishCmd": "./gradlew -Pversion=${nextRelease.version} publish && echo '${nextRelease.version}' > version.txt"
1515
}
1616
],
1717
"@semantic-release/git",

0 commit comments

Comments
 (0)