👷 added auto-release #1
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: Build and Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| - '[0-9]+.*' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Extract version from tag | |
| id: get_version | |
| run: | | |
| TAG=${GITHUB_REF#refs/tags/} | |
| VERSION=${TAG#v} | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "tag=$TAG" >> $GITHUB_OUTPUT | |
| - name: Update version in gradle.properties | |
| run: | | |
| sed -i "s/^mod_version=.*/mod_version=${{ steps.get_version.outputs.version }}/" gradle.properties | |
| echo "Updated gradle.properties with version: ${{ steps.get_version.outputs.version }}" | |
| cat gradle.properties | grep mod_version | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v3 | |
| - name: Make gradlew executable | |
| run: chmod +x gradlew | |
| - name: Build with Gradle | |
| run: ./gradlew build --no-daemon | |
| - name: Find JAR file | |
| id: find_jar | |
| run: | | |
| JAR_PATH=$(find build/libs -name "*.jar" ! -name "*-sources.jar" | head -n 1) | |
| echo "jar_path=$JAR_PATH" >> $GITHUB_OUTPUT | |
| echo "jar_name=$(basename $JAR_PATH)" >> $GITHUB_OUTPUT | |
| echo "Found JAR: $JAR_PATH" | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.get_version.outputs.tag }} | |
| name: Release ${{ steps.get_version.outputs.version }} | |
| draft: false | |
| prerelease: false | |
| files: ${{ steps.find_jar.outputs.jar_path }} | |
| body: | | |
| ## CreateProtected Mod - Version ${{ steps.get_version.outputs.version }} | |
| ### Installation | |
| 1. Download the JAR file below | |
| 2. Place it in your Minecraft `mods` folder | |
| 3. Make sure you have NeoForge ${{ vars.NEO_VERSION || '21.1.217' }} for Minecraft ${{ vars.MINECRAFT_VERSION || '1.21.1' }} installed | |
| ### Changes | |
| See the commit history for details. | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |