Skip to content

Commit

Permalink
changed deploy-app.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
MocStepan committed May 9, 2024
1 parent 4f18361 commit 4eb17e3
Showing 1 changed file with 16 additions and 37 deletions.
53 changes: 16 additions & 37 deletions .github/workflows/deploy-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,29 @@ run-name: "Run ${{github.run_id}}, triggered by ${{github.actor}}"
on:
workflow_dispatch:
pull_request:
branches:
- main
branches: [ "main" ]
jobs:
deploy-backend:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Build backend
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
cache-dependency-path: |
backend/*.gradle*
backend/**/gradle-wrapper.properties
- name: Build backend
working-directory: backend
run: |
./gradlew build --no-daemon
cp build/libs/backend-1.0.0.jar ../backend.jar
- name: Build frontend
uses: actions/setup-node@v3
- uses: actions/checkout@v4
- name: Deploy backend to Heroku
uses: akhileshns/[email protected]
with:
node-version: 20
cache: 'npm'
cache-dependency-path: frontend/package-lock.json

- name: Install dependencies
working-directory: frontend
run: |
npm install
npm run build
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: ${{ secrets.HEROKU_BACKEND_NAME }}
heroku_email: ${{ secrets.HEROKU_EMAIL }}
branch: 'main'
procfile: 'web: java $JAVA_OPTS -Dserver.port=$PORT -jar build/libs/backend-1.0.0.jar --spring.profiles.active=prod'

- name: Deploy to Heroku
deploy-frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy backend to Heroku
uses: akhileshns/[email protected]
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: ${{ secrets.HEROKU_APP_NAME }}
heroku_app_name: ${{ secrets.HEROKU_FRONTEND_NAME }}
heroku_email: ${{ secrets.HEROKU_EMAIL }}
procfile: |
web: java $JAVA_OPTS -Dserver.port=$PORT -jar backend.jar --spring.profiles.active=prod
build: cd frontend && npm start
appdir: 'frontend'

0 comments on commit 4eb17e3

Please sign in to comment.