name: Build on: push: branches: [ "main" ] pull_request: branches: [ "main" ] release: types: [created] jobs: build: runs-on: ubuntu-latest permissions: contents: read packages: write steps: - uses: actions/checkout@v4 - name: Set up JDK 17 uses: actions/setup-java@v4 with: java-version: '17' distribution: 'temurin' cache: maven - name: Build with Maven run: mvn -B package --file pom.xml - name: Upload build artifacts uses: actions/upload-artifact@v4 with: name: NoBullying path: target/nobullying-*.jar # Create release with artifacts when a release is created release: needs: build if: github.event_name == 'release' runs-on: ubuntu-latest permissions: contents: write steps: - name: Download build artifacts uses: actions/download-artifact@v4 with: name: NoBullying - name: Upload release artifacts uses: softprops/action-gh-release@v2 with: files: nobullying-*.jar