Update build.yml
This commit is contained in:
parent
1ed16871d3
commit
c972053cd1
@ -6,7 +6,42 @@ on:
|
||||
- '**'
|
||||
|
||||
jobs:
|
||||
build-jar:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: 'adopt'
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 'node' # Use latest version
|
||||
npm-version: 'latest'
|
||||
|
||||
- name: Build frontend
|
||||
run: |
|
||||
cd frontend
|
||||
npm install
|
||||
npm run build
|
||||
cd ..
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x ./gradlew
|
||||
|
||||
- name: Build .jar with Gradle
|
||||
run: ./gradlew clean bootJar
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: jar-artifact
|
||||
path: build/libs/*.jar
|
||||
|
||||
build-docker-image:
|
||||
runs-on: ubuntu-22.04
|
||||
@ -19,8 +54,8 @@ jobs:
|
||||
run: |
|
||||
GIT_TAG=$(git tag --points-at HEAD)
|
||||
if [[ "$GIT_TAG" == v* ]]; then
|
||||
TAG_NAME=${GIT_TAG#v}
|
||||
echo "Extracted tag name: $TAG_NAME"
|
||||
VERSION=${GIT_TAG#v}
|
||||
echo "Extracted tag name: $VERSION"
|
||||
else
|
||||
echo "This is not a tag push with 'v' prefix, skipping..."
|
||||
exit 78
|
||||
@ -47,15 +82,15 @@ jobs:
|
||||
path: build/libs
|
||||
|
||||
- name: Build Docker Image
|
||||
run: docker build . -t walzen665/sharepulse:latest
|
||||
run: docker build . -t walzen665/sharepulse:$VERSION
|
||||
|
||||
- name: Tag Docker image
|
||||
run: docker tag walzen665/sharepulse:latest git.walzen665.de/walzen665/sharepulse:latest
|
||||
run: docker tag walzen665/sharepulse:latest git.walzen665.de/walzen665/sharepulse:$VERSION
|
||||
|
||||
- name: Log in to Gitea Docker Registry
|
||||
run: echo ${{ secrets.GITEAREGISTRYTOKEN }} | docker login -u ${{ secrets.GITEAREGISTRYUSERNAME }} --password-stdin https://git.walzen665.de
|
||||
|
||||
- name: Push Docker Image to Gitea
|
||||
run: docker push git.walzen665.de/walzen665/sharepulse:latest
|
||||
run: docker push git.walzen665.de/walzen665/sharepulse:$VERSION
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user