Update build.yml for improved release process and artifact management #12
Workflow file for this run
This file contains hidden or 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: Java CI/CD | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build JAR | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| 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 clean package -DskipTests | |
| - name: Upload JAR artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: jar | |
| path: target/TicTacToe-*.jar | |
| release: | |
| name: Create GitHub Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download JAR artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: jar | |
| path: target | |
| - name: Create Release + Upload Asset | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: target/TicTacToe-*.jar | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |