Prepare Release #3
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: Prepare Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| digit: | |
| type: choice | |
| description: 'SemVer digit to increment' | |
| required: true | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| permissions: | |
| contents: write | |
| jobs: | |
| prepare-release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| with: | |
| fetch-depth: '0' | |
| - name: Setup Git user | |
| uses: fregante/setup-git-user@v2.0.2 | |
| - name: Setup JDK 21 | |
| uses: actions/setup-java@v2 | |
| with: | |
| distribution: 'temurin' | |
| java-version: 21 | |
| - name: Cache Gradle packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.gradle/caches | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | |
| restore-keys: ${{ runner.os }}-gradle | |
| - name: Grant execute permission to gradlew | |
| run: chmod +x gradlew | |
| - name: Version Increment | |
| uses: reecetech/version-increment@2024.10.1 | |
| id: version | |
| with: | |
| scheme: 'semver' | |
| tag_prefix: 'v' | |
| increment: ${{ github.event.inputs.digit }} | |
| - name: Update version in gradle.properties | |
| run: | | |
| sed -i 's/^mod_version=.*$/mod_version=${{ steps.version.outputs.version }}/' gradle.properties | |
| - name: Append changelog to docs | |
| run: | | |
| ./gradlew appendChangelog | |
| - name: Commit changes | |
| run: | | |
| git add --all | |
| git commit -m "v${{ steps.version.outputs.version }}" | |
| - name: Create a tag | |
| run: | | |
| git tag v${{ steps.version.outputs.version }} | |
| - name: Build with Gradle | |
| run: ./gradlew build | |
| - name: Merge main into release | |
| run: | | |
| git fetch origin release | |
| git checkout -b release origin/release | |
| git merge main | |
| - name: Merge release into docs | |
| run: | | |
| git fetch origin docs | |
| git checkout -b docs origin/docs | |
| git merge release | |
| - name: Push branches and tags | |
| run: | | |
| git push --tags origin main release docs | |
| - name: Publish to modrinth with Gradle | |
| run: ./gradlew modrinth | |
| env: | |
| MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} |