From 8bf419df2284067ee85d03100da0ec22e0e4e185 Mon Sep 17 00:00:00 2001 From: Jonathan Hiles Date: Sun, 10 Dec 2023 20:04:12 +1000 Subject: [PATCH] ci: add release workflow for mc/1.20.2 maintenance branch --- .github/workflows/release-1.20.2.yml | 72 ++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/release-1.20.2.yml diff --git a/.github/workflows/release-1.20.2.yml b/.github/workflows/release-1.20.2.yml new file mode 100644 index 0000000..ed75550 --- /dev/null +++ b/.github/workflows/release-1.20.2.yml @@ -0,0 +1,72 @@ +# Prepares, builds and publishes new releases + +name: Release 1.20.2 + +# On changes to release branches +on: + push: + branches: + - mc/1.20.2 + workflow_dispatch: + +jobs: + release: + name: Release + + runs-on: ubuntu-latest + + steps: + - name: 🙌 Prepare release + id: release-please + uses: google-github-actions/release-please-action@v4 + with: + config-file: .github/release-please.json + target-branch: mc/1.20.2 + token: ${{ secrets.GITHUB_TOKEN }} + + outputs: + paths_released: ${{ steps.release-please.outputs.paths_released }} + releases: ${{ toJson(steps.release-please.outputs) }} + + publish: + name: Publish + + runs-on: ubuntu-latest + needs: release + if: ${{ needs.release.outputs.paths_released != '[]' }} + + strategy: + fail-fast: false + matrix: + path: ${{ fromJson(needs.release.outputs.paths_released) }} + + steps: + - name: ✨ Checkout repository + uses: actions/checkout@v4 + + - name: ☕ Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: temurin + + - name: 🐘 Set up Gradle + uses: gradle/gradle-build-action@v2 + + - name: 📢 Publish new release + uses: gradle/gradle-build-action@v2 + with: + arguments: ${{ matrix.path == '.' && ':publish' || format('{0}:publish', matrix.path) }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} + CURSEFORGE_DEBUG: ${{ secrets.CURSEFORGE_DEBUG }} + MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} + MODRINTH_DEBUG: ${{ secrets.MODRINTH_DEBUG }} + + - name: 📦 Upload artifacts + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ fromJson(needs.release.outputs.releases)[matrix.path == '.' && 'tag_name' || format('{0}--tag_name', matrix.path)] }} + files: ${{ matrix.path }}/**/build/libs/* + token: ${{ secrets.GITHUB_TOKEN }}