Better column widths #45
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 Maven, and cache/restore any dependencies to improve the workflow execution time | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | |
name: Java CI with Maven | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
name: Build the Java service JAR | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'zulu' | |
cache: maven | |
- name: Build with Maven | |
run: mvn package -ntp -B -Pproduction | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: pi4j-board-info-service | |
path: target/pi4j-board-info-service.jar | |
# Uses approval as described on | |
# https://trstringer.com/github-actions-manual-approval/ | |
deploy: | |
name: Deploy to server | |
needs: build | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
steps: | |
#- name: Get deployment approval | |
# uses: trstringer/manual-approval@v1 | |
# with: | |
# secret: ${{ github.TOKEN }} | |
# approvers: FDelporte | |
- name: Download the build output | |
uses: actions/download-artifact@v2 | |
with: | |
name: pi4j-board-info-service | |
- name: List available packages | |
run: | | |
ls -la | |
- name: Upload to production server | |
run: | | |
sshpass -p '${{ secrets.SERVER_PASSWORD }}' scp -o StrictHostKeyChecking=no pi4j-board-info-service.jar ${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_ADDRESS }}:${{ secrets.SERVER_LOCATION }} | |
- name: Restart the service on the production server | |
run: | | |
sshpass -p '${{ secrets.SERVER_PASSWORD }}' ssh -t ${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_ADDRESS }} 'sudo systemctl restart pi4j_board_info.service' | |