🔘 Beta - Build, Test, and Publish #8
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, test and push the latest version on the beta environment. | |
on: [push, workflow_dispatch] | |
name: Build, Test and publish on qualification environment | |
jobs: | |
deploy: | |
name: test-build-publish-beta | |
runs-on: self-hosted | |
steps: | |
- uses: actions/checkout@v4 | |
############################################ | |
# Install Java | |
########################################### | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'adopt' | |
cache: maven | |
############################################ | |
# Maven build and testing | |
########################################### | |
- name: Build and test with Maven | |
run: mvn --batch-mode --update-snapshots install | |
############################################ | |
# Deploy api JAR to qualification environment | |
########################################### | |
- name: Deploy API to qualification server | |
uses: easingthemes/ssh-deploy@main | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
ARGS: "-rltgoDzvO --delete" | |
SOURCE: "/api/target/api-0.0.1-SNAPSHOT.jar" | |
REMOTE_HOST: ${{ secrets.REMOTE_BETA_HOST }} | |
REMOTE_USER: ${{ secrets.REMOTE_BETA_USER }} | |
TARGET: "/opt/open4goods/bin/latest/api-latest.jar" | |
############################################ | |
# Deploy ui JAR to qualification environment | |
########################################### | |
- name: Deploy UI to qualification server | |
uses: easingthemes/ssh-deploy@main | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
ARGS: "-rltgoDzvO --delete" | |
SOURCE: "/ui/target/ui-0.0.1-SNAPSHOT.jar" | |
REMOTE_HOST: ${{ secrets.REMOTE_BETA_HOST }} | |
REMOTE_USER: ${{ secrets.REMOTE_BETA_USER }} | |
TARGET: "/opt/open4goods/bin/latest/ui-latest.jar" | |
############################################ | |
# Restarting application | |
########################################### | |
- name: Publish applications | |
uses: appleboy/ssh-action@v1.0.2 | |
with: | |
host: ${{ secrets.REMOTE_BETA_HOST }} | |
username: ${{ secrets.REMOTE_BETA_USER }} | |
key: ${{ secrets.SSH_PRIVATE_KEY}} | |
script: sh /opt/open4goods/bin/publish-jars.sh | |