Add GH build workflow #2
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
name: Build and Publish | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- '**' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up Java 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: adopt-hotspot | |
- name: Setup maven repo | |
uses: s4u/[email protected] | |
with: | |
servers: | | |
[{ | |
"id": "waterdog-snapshots", | |
"username": "${{ secrets.DEPLOY_USERNAME }}", | |
"password": "${{ secrets.DEPLOY_PASSWORD }}" | |
}] | |
- name: Build | |
if: ${{ github.ref != 'refs/heads/master' }} | |
run: mvn -B clean package | |
shell: bash | |
- name: Build and Deploy | |
if: ${{ github.ref == 'refs/heads/master' }} | |
run: mvn -B clean package | |
shell: bash | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: waterdog | |
path: waterdogpe/target/stargate-waterdogpe-*.jar | |
- name: Create pre-release | |
if: ${{ github.ref != 'refs/heads/master' }} | |
uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "latest" | |
prerelease: true | |
title: "Snapshot Build" | |
files: | | |
waterdogpe/target/stargate-waterdogpe-*.jar |