Merge pull request #66 from AlyaClient/dev #130
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: Build and Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| types: | |
| - closed | |
| branches: | |
| - main | |
| jobs: | |
| build-and-release: | |
| permissions: | |
| contents: write | |
| if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 25 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '25' | |
| distribution: 'zulu' | |
| cache: gradle | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Build with Gradle | |
| run: ./gradlew build --no-daemon | |
| - name: Package release zip | |
| run: | | |
| mkdir -p release | |
| cp build/libs/Alya-1.0.jar release/Alya.jar | |
| cp build/libs/libs release/ | |
| cp jars/start.sh release/start.sh | |
| cp jars/README.md release/README.md | |
| cd release | |
| zip -r ../alya-release.zip . | |
| - name: Get short SHA | |
| id: sha | |
| run: echo "short=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT | |
| - name: Update latest tag | |
| run: | | |
| git tag -f latest | |
| git push --force origin latest | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: build-${{ steps.sha.outputs.short }} | |
| name: Build ${{ steps.sha.outputs.short }} | |
| body: | | |
| Automated release from commit ${{ github.sha }} | |
| ${{ github.event.head_commit.message || github.event.pull_request.title }} | |
| files: alya-release.zip | |
| draft: false | |
| prerelease: false | |
| make_latest: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Update latest release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: latest | |
| name: Latest Build | |
| body: | | |
| Always points to the most recent successful build. | |
| Current commit: ${{ github.sha }} (${{ steps.sha.outputs.short }}) | |
| ${{ github.event.head_commit.message || github.event.pull_request.title }} | |
| files: alya-release.zip | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |