diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..b769b70 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,50 @@ +name: Build + +on: + workflow_dispatch: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Prepare Project + uses: actions/checkout@v3 + with: + ref: 'main' + + - name: Set up JDK 21 + uses: actions/setup-java@v3 + with: + java-version: '21' + distribution: 'temurin' + cache: maven + + - name: Build with Maven + run: | + mvn -B install --file pom.xml + echo "PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: '${{ env.PROJECT_VERSION }}-SNAPSHOT' + release_name: SimpleTags + draft: false + prerelease: true + + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: './target/SimpleStaffChat-${{ env.PROJECT_VERSION }}.jar' + asset_name: 'SimpleStaffChat-${{ env.PROJECT_VERSION }}.jar' + asset_content_type: 'application/java-archive'