Skip to content

Merge pull request #105 from solid-connection/main #16

Merge pull request #105 from solid-connection/main

Merge pull request #105 from solid-connection/main #16

Workflow file for this run

name: Build Gradle and Deploy
on:
push:
branches: [ "release" ]
workflow_dispatch:
jobs:
build-gradle:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Create application-secret.yml
run: echo "${{ secrets.APPLICATION_SECRET }}" > src/main/resources/application-secret.yml
- name: Create application-prod.yml
run: echo "${{ secrets.APPLICATION_PROD }}" > src/main/resources/application-prod.yml
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
- name: Grant execute permission for Gradle wrapper(gradlew)
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew bootJar -Dspring.profiles.active=prod
- name: Copy jar file to remote
uses: appleboy/scp-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PRIVATE_KEY }}
source: "./build/libs/*.jar"
target: "/home/${{ secrets.USERNAME }}/solid-connect-server/"
- name: Copy docker file to remote
uses: appleboy/scp-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PRIVATE_KEY }}
source: "./Dockerfile"
target: "/home/${{ secrets.USERNAME }}/solid-connect-server/"
- name: Copy docker compose file to remote
uses: appleboy/scp-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PRIVATE_KEY }}
source: "./docker-compose.yml"
target: "/home/${{ secrets.USERNAME }}/solid-connect-server/"
- name: Copy nginx configuration file to remote
uses: appleboy/scp-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PRIVATE_KEY }}
source: "./nginx.conf"
target: "/home/${{ secrets.USERNAME }}/solid-connect-server/"
- name: Run docker compose
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PRIVATE_KEY }}
script_stop: true
script: |
cd /home/${{ secrets.USERNAME }}/solid-connect-server
docker-compose down
docker-compose up -d --build