Skip to content

chore/database-migration (#154) #41

chore/database-migration (#154)

chore/database-migration (#154) #41

Workflow file for this run

name: CD - Deploy on Tags
on:
push:
tags:
- '*.*.*'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
- name: Setup Gradle cache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build application JAR
run: ./gradlew --no-daemon bootJar copyJarToDeploy
- name: Deploy to server
uses: SamKirkland/[email protected]
if: ${{ !env.ACT }}
with:
server: ${{ secrets.FTP_SERVER }}
username: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
server-dir: ${{ vars.FTP_DIR }}
local-dir: ./deploy/
- name: Wait a bit at the end of deployment
run: |
sleep ${{ vars.DELAY_AFTER_DEPLOY }}
create-github-release:
needs: deploy
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: marvinpinto/[email protected]
if: ${{ !env.ACT }}
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
draft: true
restart-server:
if: ${{ vars.ENABLE_HTTP_CALLS }}
needs:
- deploy
uses: ./.github/workflows/restart-server.yml
secrets: inherit
notify-release-analytics:
if: ${{ vars.ENABLE_HTTP_CALLS }}
needs:
- deploy
- restart-server
runs-on: ubuntu-latest
steps:
- name: Get the version
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Notify release
uses: fjogeleit/http-request-action@v1
with:
url: ${{ vars.SERVER_ENDPOINT }}/notifyRelease?version=${{ steps.get_version.outputs.VERSION }}
method: POST
customHeaders: >-
{
"X-Secret-Key": "${{ secrets.SERVER_MAINTENANCE_SECRET_KEY }}"
}