Skip to content

Commit 261fc6b

Browse files
committed
add release.yml action
1 parent 3d5d012 commit 261fc6b

1 file changed

Lines changed: 97 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '[0-9]+(\.[0-9]+)*'
7+
8+
jobs:
9+
frontend:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Setup Node.js
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: '18.14'
18+
cache: 'npm'
19+
cache-dependency-path: frontend/package-lock.json
20+
21+
- name: Install dependencies
22+
working-directory: ./frontend
23+
run: npm ci
24+
25+
- name: Build frontend
26+
working-directory: ./frontend
27+
run: npm run build
28+
29+
- name: Upload frontend dist
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: frontend-dist
33+
path: frontend/dist/
34+
35+
backend:
36+
needs: frontend
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v4
40+
41+
- name: Set up JDK 17
42+
uses: actions/setup-java@v4
43+
with:
44+
java-version: '17'
45+
distribution: 'temurin'
46+
cache: 'maven'
47+
48+
- name: Download frontend dist
49+
uses: actions/download-artifact@v4
50+
with:
51+
name: frontend-dist
52+
path: frontend/dist/
53+
54+
- name: Build with Maven
55+
run: mvn package
56+
57+
- name: Upload JAR artifacts
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: backend-artifacts
61+
path: target/o-neko*-layered.jar
62+
63+
release:
64+
needs: backend
65+
runs-on: ubuntu-latest
66+
steps:
67+
- uses: actions/checkout@v4
68+
69+
- name: Download backend artifacts
70+
uses: actions/download-artifact@v4
71+
with:
72+
name: backend-artifacts
73+
path: .
74+
75+
- name: Set up Docker Buildx
76+
uses: docker/setup-buildx-action@v3
77+
78+
- name: Login to Docker Hub
79+
uses: docker/login-action@v3
80+
with:
81+
username: ${{ secrets.DOCKER_USERNAME }}
82+
password: ${{ secrets.DOCKER_PASSWORD }}
83+
84+
- name: Extract tag name
85+
id: tag
86+
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
87+
88+
- name: Build and push
89+
uses: docker/build-push-action@v5
90+
with:
91+
context: .
92+
push: true
93+
tags: |
94+
subshellgmbh/o-neko:latest
95+
subshellgmbh/o-neko:${{ steps.tag.outputs.tag }}
96+
build-args: |
97+
JAR_FILE=$(ls *-layered.jar)

0 commit comments

Comments
 (0)