Skip to content

Deploy app

Deploy app #20254

Workflow file for this run

name: "Deploy app"
on:
push:
branches:
- master
schedule:
- cron: '*/10 * * * *' # Jede 10. Minute für regelmäßige Ausführung
- cron: '7,23,37,53 * * * *' # Unregelmäßige Zeiten für zusätzliche Ausführungen
jobs:
periodic-request:
runs-on: ubuntu-latest
steps:
- name: Curl request with optional delay
run: |
if [ $((RANDOM % 2)) -eq 1 ]; then
sleep $((RANDOM % 180)) # Zufällige Verzögerung bis zu 180 Sekunden
fi
curl -X POST ${{ secrets.RENDER_URL }}
build-frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
- name: "Build Frontend"
working-directory: frontend
run: |
npm install
npm run build
- uses: actions/upload-artifact@v3
with:
name: frontend-build
path: frontend/dist
build-backend:
runs-on: ubuntu-latest
needs: build-frontend
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: frontend-build
path: backend/src/main/resources/static
- name: Setup JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Build whit Maven
run: mvn -B package --file backend/pom.xml
- uses: actions/upload-artifact@v3
with:
name: app.jar
path: backend/target/app.jar
push-to-docker-hub:
runs-on: ubuntu-latest
needs: build-backend
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: app.jar
path: backend/target
- name: Login to Docker
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Push to Docker
uses: docker/build-push-action@v3
with:
push: true
tags: ${{ secrets.DOCKERHUB_TAG }}
context: .
deploy-render:
name: Deployment render.com
runs-on: ubuntu-latest
needs: push-to-docker-hub
environment:
name: Test Deploy
url: https://movie-app-7tas.onrender.com
steps:
- name: Trigger render.com Deployment
run: |
curl -X POST ${{ secrets.RENDER_DEPLOY_HOOK_URL }}