Fix build issues #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle | |
name: Production deployment | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ "production" ] | |
pull_request: | |
branches: [ "production" ] | |
permissions: | |
contents: read | |
jobs: | |
build-frontend: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
- name: Run install | |
uses: borales/[email protected] | |
with: | |
dir: 'frontend' | |
cmd: install | |
- name: Run build | |
uses: borales/[email protected] | |
with: | |
dir: 'frontend' | |
cmd: build | |
- name: Deploy files | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.UBUNTU_USERNAME }} | |
key: ${{ secrets.SSH_KEY }} | |
source: "frontend/dist/" | |
target: "/chorister/www" | |
strip_components: 2 | |
rm: true | |
build-backend: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: 'gradle' | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
working-directory: backend | |
- name: Build with Gradle | |
run: ./gradlew bootJar | |
working-directory: backend | |
- name: Deploy .jar | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.UBUNTU_USERNAME }} | |
key: ${{ secrets.SSH_KEY }} | |
source: "backend/build/libs/chorister.jar" | |
target: "/chorister/bin" | |
strip_components: 3 | |
- name: Restart Chorister service | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.UBUNTU_USERNAME }} | |
key: ${{ secrets.SSH_KEY }} | |
script: sudo systemctl restart chorister | |
db-migration: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Migrate DB changes | |
uses: liquibase-github-actions/[email protected] | |
with: | |
url: "jdbc:postgresql://common-werebat-6703.7tc.cockroachlabs.cloud:26257/chorister" | |
classpath: "backend/src/main/resources" | |
changelogFile: "backend/src/main/resources/db/changelog/changelog-master.yaml" | |
username: "${{ secrets.PRODUCTION_DB_USERNAME }}" | |
password: "${{ secrets.PRODUCTION_DB_PASSWORD }}" | |
driver: "org.postgresql.Driver" |