[editor only] new deploy approach #553
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 will build a Java project with Gradle | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle | ||
name: SNAPSHOT Build | ||
on: | ||
push: | ||
branches: [ master ] | ||
jobs: | ||
linux: | ||
if: "!contains(github.event.head_commit.message, 'cd skip')" | ||
runs-on: ubuntu-latest | ||
needs: [windows, macOS] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
- name: Setup Eclipse Temurin OpenJDK 17 | ||
uses: actions/setup-java@v2 | ||
with: | ||
distribution: 'temurin' | ||
java-version: 17 | ||
- name: Add build info | ||
env: | ||
WORKFLOW_RUN: ${{ github.run_number }} | ||
run: | | ||
echo "build=$WORKFLOW_RUN" >> assets/configs/app.properties | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
- name: Build JAR dist files | ||
env: | ||
WORKFLOW_RUN: ${{ github.run_number }} | ||
run: ./gradlew dist -PSNAPSHOT=true | ||
- name: Build deb package | ||
env: | ||
WORKFLOW_RUN: ${{ github.run_number }} | ||
run: ./gradlew jpackage -PSNAPSHOT=true | ||
- name: Fix deb file names | ||
run: mv build/jpackage/*.deb Linux.HyperLap2D-SNAPSHOT.deb | ||
- name: Generate build info | ||
env: | ||
WORKFLOW_RUN: ${{ github.run_number }} | ||
run: | | ||
echo "{ \"build\": $WORKFLOW_RUN }" > snapshot.json | ||
- name: Download macOS and Windows Release | ||
uses: actions/download-artifact@v4.1.8 | ||
- name: Upload deb artifact | ||
uses: actions/upload-artifact@v4.4.0 | ||
with: | ||
name: Linux.HyperLap2D-SNAPSHOT.deb | ||
path: Linux.HyperLap2D-SNAPSHOT.deb | ||
- name: Sync files with production server | ||
uses: appleboy/scp-action@v0.1.7 | ||
with: | ||
host: ${{ secrets.DEPLOY_SSH_HOST }} | ||
username: ${{ secrets.DEPLOY_SSH_USERNAME }} | ||
password: ${{ secrets.DEPLOY_SSH_PASSWORD }} | ||
port: ${{ secrets.DEPLOY_SSH_PORT }} | ||
source: "Linux.HyperLap2D-SNAPSHOT.deb,Windows.HyperLap2D-SNAPSHOT.exe,macOS.HyperLap2D-SNAPSHOT.dmg",snapshot.json | ||
target: ${{ secrets.DEPLOY_SSH_TARGET_PATH }} | ||
- name: Publish SNAPSHOT artifacts | ||
if: "!contains(github.event.head_commit.message, 'editor only')" | ||
env: | ||
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} | ||
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} | ||
run: ./gradlew build publish -PSNAPSHOT=true | ||
windows: | ||
if: "!contains(github.event.head_commit.message, 'cd skip')" | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
- name: Setup Eclipse Temurin OpenJDK 17 | ||
uses: actions/setup-java@v2 | ||
with: | ||
distribution: 'temurin' | ||
java-version: 17 | ||
- name: Add build info | ||
env: | ||
WORKFLOW_RUN: ${{ github.run_number }} | ||
run: | | ||
echo "build=$Env:WORKFLOW_RUN" >> assets/configs/app.properties | ||
- name: Build JAR dist files | ||
env: | ||
WORKFLOW_RUN: ${{ github.run_number }} | ||
run: ./gradlew.bat dist -PSNAPSHOT=true | ||
- name: Build exe package | ||
env: | ||
WORKFLOW_RUN: ${{ github.run_number }} | ||
run: ./gradlew.bat jpackage -PSNAPSHOT=true | ||
- name: Fix file names | ||
run: mv build/jpackage/*.exe Windows.HyperLap2D-SNAPSHOT.exe | ||
- name: Upload exe artifact | ||
uses: actions/upload-artifact@v4.4.0 | ||
with: | ||
name: Windows.HyperLap2D-SNAPSHOT.exe | ||
path: Windows.HyperLap2D-SNAPSHOT.exe | ||
macOS: | ||
if: "!contains(github.event.head_commit.message, 'cd skip')" | ||
runs-on: macOS-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
- name: Setup Eclipse Temurin OpenJDK 17 | ||
uses: actions/setup-java@v2 | ||
with: | ||
distribution: 'temurin' | ||
java-version: 17 | ||
- name: Add build info | ||
env: | ||
WORKFLOW_RUN: ${{ github.run_number }} | ||
run: | | ||
echo "build=$WORKFLOW_RUN" >> assets/configs/app.properties | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
- name: Build JAR dist files | ||
env: | ||
WORKFLOW_RUN: ${{ github.run_number }} | ||
run: ./gradlew dist -PSNAPSHOT=true | ||
- name: Build dmg package | ||
env: | ||
WORKFLOW_RUN: ${{ github.run_number }} | ||
run: ./gradlew jpackage -PSNAPSHOT=true | ||
- name: Fix file names | ||
run: mv build/jpackage/*.dmg macOS.HyperLap2D-SNAPSHOT.dmg | ||
- name: Upload dmg artifact | ||
uses: actions/upload-artifact@v4.4.0 | ||
with: | ||
name: macOS.HyperLap2D-SNAPSHOT.dmg | ||
path: macOS.HyperLap2D-SNAPSHOT.dmg |