Merge branch 'main' of github.com:ZetaPlugins/WYG #1
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: Release on version change | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - 'build.gradle' # only run when build.gradle changes | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| - name: Extract version from build.gradle | |
| id: get_version | |
| run: | | |
| VERSION=$(grep "^version" build.gradle | sed "s/version *= *['\"]//" | sed "s/['\"]//") | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Cache Gradle | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| restore-keys: gradle-${{ runner.os }}- | |
| - name: Build shadowJar | |
| run: ./gradlew shadowJar --no-daemon | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: plugin-jar | |
| path: build/libs/*.jar | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ steps.get_version.outputs.version }} | |
| name: Release v${{ steps.get_version.outputs.version }} | |
| draft: false | |
| prerelease: false | |
| files: build/libs/*.jar | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |