update #108
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: Latest Build | |
| on: | |
| push: | |
| branches: ['1.20.1', '1.21'] | |
| paths: ['src/**', '**/*.gradle', 'gradle.properties'] | |
| concurrency: | |
| group: auto-build-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| PUBLISH: ${{ !contains(github.event.commits[0].message, '[no-snapshot]') }} | |
| MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} | |
| MAVEN_USER: ${{ secrets.MAVEN_USER }} | |
| SNAPSHOT: true | |
| CI: true | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # do a full checkout instead of a shallow clone of HEAD so spotless's ratchetFrom works | |
| - name: Setup Build | |
| uses: ./.github/actions/build_setup | |
| - name: Get Mod Version | |
| id: ver | |
| run: echo "version=$(./gradlew -q printVersion)" >> $GITHUB_OUTPUT | |
| - name: Version Suffix | |
| id: suffix | |
| run: echo "VERSION_SUFFIX=$(echo "${{ github.sha }}" | cut -c 1-7)" >> $GITHUB_ENV | |
| - name: Build | |
| run: ./gradlew build | |
| - name: Publish to Maven | |
| if: ${{ github.repository_owner == 'GregTechCEu' && env.PUBLISH == 'true' }} | |
| run: ./gradlew publish | |
| - name: Rename Jars | |
| if: ${{ env.PUBLISH == 'true' }} | |
| run: for file in build/libs/*; do mv "$file" "${file/SHOT/SHOT+$(date --utc '+%Y%m%d-%H%M%S')-${{ env.VERSION_SUFFIX }}}"; done; | |
| - name: Upload Artifacts | |
| if: ${{ env.PUBLISH == 'true' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-artifacts | |
| path: build/libs/* | |
| if-no-files-found: error | |
| retention-days: 90 | |
| - name: Changelog | |
| id: changelog | |
| if: ${{ env.PUBLISH == 'true' }} | |
| uses: mikepenz/release-changelog-builder-action@v5 | |
| with: | |
| configuration: "./.github/json/config-latest${{ contains(github.ref_name, '1.21') && '-1.21' || '' }}.json" | |
| toTag: ${{ github.ref }} | |
| fetchViaCommits: true | |
| failOnError: false | |
| - name: Release Latest | |
| if: ${{ env.PUBLISH == 'true' }} | |
| uses: andelf/nightly-release@46e2d5f80828ecc5c2c3c819eb31186a7cf2156c | |
| with: | |
| tag_name: latest-${{ github.ref_name }} | |
| name: '${{ github.ref_name }}-${{ steps.ver.outputs.version}} SNAPSHOT ${{ env.VERSION_SUFFIX }}' | |
| prerelease: true | |
| body: | | |
| The latest build of GTM for Minecraft ${{ github.ref_name }}. | |
| Please report any [issues](https://github.com/GregTechCEu/GregTech-Modern/issues). | |
| ${{ steps.changelog.outputs.changelog }} | |
| files: build/libs/*.jar |