Skip to content

Update to 1.21.2

Update to 1.21.2 #148

Workflow file for this run

name: Deploy
on:
push:
branches:
- 'release/*'
- 'snapshot/*'
paths:
- 'versions/*/patches/**'
- 'versions/*/build.gradle.kts'
workflow_dispatch:
jobs:
# Only run if all dependencies are release versions
# SNAPSHOT versions are unstable, which would make our published artifact unstable
verify:
name: Verify
runs-on: ubuntu-latest
# Guard against manual runs on the wrong branch
if: startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/snapshot/')
steps:
- uses: actions/checkout@v4
- uses: gradle/actions/wrapper-validation@v3
- name: Version Name
id: version
shell: bash
run: |
version="${GITHUB_REF_NAME##*/}"
formatted_version=$(echo "v${version}" | sed 's/\./_/g')
echo "folder_name=${version}" >> $GITHUB_OUTPUT
echo "project_name=${formatted_version}" >> $GITHUB_OUTPUT
- name: Verify Dependencies
id: verify_deps
shell: bash
run: |
if [[ "$(grep -i -- '-SNAPSHOT' versions/${{ steps.version.outputs.folder_name }}/build.gradle.kts | wc -l)" -eq "0" ]] ; then
echo "all_release=true" >> $GITHUB_OUTPUT
else
echo "all_release=false" >> $GITHUB_OUTPUT
echo '⚠️ Not releasing since build.gradle.kts contains snapshots!' >> $GITHUB_STEP_SUMMARY
fi
outputs:
folder_name: ${{ steps.version.outputs.folder_name }}
project_name: ${{ steps.version.outputs.project_name }}
deps_all_release: ${{ steps.verify_deps.outputs.all_release }}
applyPatches:
name: Apply Patches
runs-on: ubuntu-latest
needs: verify
if: needs.verify.outputs.deps_all_release == 'true'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
- uses: gradle/actions/setup-gradle@v3
name: Setup Gradle
- name: Apply Patches
run: ./gradlew ':versions:${{ needs.verify.outputs.project_name }}:setup'
- name: Tar sources
run: tar --exclude '*/.git*' -cf sources.tar versions/${{ needs.verify.outputs.folder_name }}/src/
- uses: actions/upload-artifact@v4
name: Archive patched sources
with:
name: patched-sources
path: sources.tar
if-no-files-found: error
retention-days: 1
# We will only attempt to deploy an artifact if the current version config successfully compiles
# Note: We don't publish the sources or build output, this only validates that it _does_ build
build:
name: Build
runs-on: ubuntu-latest
needs: [verify, applyPatches]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
- uses: actions/download-artifact@v4
with:
name: patched-sources
path: sources
- name: Extract sources
run: tar -xf sources/sources.tar versions/${{ needs.verify.outputs.folder_name }}/src/ && rm -r sources/
- uses: gradle/actions/setup-gradle@v3
name: Setup Gradle
- name: Build
run: ./gradlew ':versions:${{ needs.verify.outputs.project_name }}:build'
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: [verify, build]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
- uses: gradle/actions/setup-gradle@v3
name: Setup Gradle
- name: Deploy Mache Artifact
run: ./gradlew ':versions:${{ needs.verify.outputs.project_name }}:publishMachePublicationToPaperMCRepository'
env:
BUILD_ID: ${{ env.GITHUB_RUN_NUMBER }}
ORG_GRADLE_PROJECT_PaperMCUsername: ${{ secrets.NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_PaperMCPassword: ${{ secrets.NEXUS_PASSWORD }}
cleanup:
name: Cleanup
runs-on: ubuntu-latest
needs: [verify, applyPatches, build, deploy]
if: always()
steps:
- uses: geekyeggo/delete-artifact@v5
with:
name: patched-sources