Skip to content

Release Plazma (1.21.3) #140

Release Plazma (1.21.3)

Release Plazma (1.21.3) #140

Workflow file for this run

name: Release Plazma (1.21.3)
on:
push:
branches: [ "ver/*", "dev/*", "feat/**/*" ]
paths:
- "patches/server/**.patch"
- "patches/api/**.patch"
- "gradle.properties"
- "release.yml"
workflow_dispatch:
env:
ORG_NAME: PlazmaMC
jobs:
release:
name: Release Plazma
strategy:
matrix:
base_jdk: [21]
os: [ubuntu-22.04]
if: "!startsWith(github.event.commits[0].message, '[CI-Skip]')"
runs-on: ${{ matrix.os }}
steps:
- name: Setup Variables
id: setup
env:
BRANCH: ${{ github.ref_name }}
run: echo "VERSION=${BRANCH##*/}" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout javadocs
uses: actions/checkout@v4
continue-on-error: true
if: startsWith(github.ref_name, 'ver/') || startsWith(github.ref_name, 'dev/')
with:
repository: PlazmaMC/Javadocs
ref: ${{ env.VERSION }}
token: ${{ secrets.GH_PAT }}
path: javadoc
- name: Checkout javadocs
uses: actions/checkout@v4
if: startsWith(github.ref_name, 'ver/') || startsWith(github.ref_name, 'dev/')
with:
repository: PlazmaMC/Javadocs
token: ${{ secrets.GH_PAT }}
path: jdmain
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v4
- name: Set up GraalVM ${{ matrix.base_jdk }}
uses: graalvm/setup-graalvm@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
java-version: ${{ matrix.base_jdk }}
version: latest
cache: 'gradle'
- name: Configure Git
run: git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" && git config --global user.name "github-actions[bot]"
- name: Get Release Number
if: startsWith(github.ref_name, 'ver/')
run: echo "BUILD_NUMBER=$(git ls-remote --tags origin | grep "build/${{ env.VERSION }}" | wc -l)" >> $GITHUB_ENV
- name: Apply Patches
run: ./gradlew applyPatches --stacktrace
- name: Build
run: ./gradlew build --stacktrace
- name: Create Reobf Jar
run: ./gradlew createReobfPaperclipJar --stacktrace
- name: Create Mojmap Jar
run: ./gradlew createMojmapPaperclipJar --stacktrace
- name: Update Sources
if: startsWith(github.ref_name, 'ver/') || startsWith(github.ref_name, 'dev/')
run: |
cd Plazma-Server
cp -r ./.gradle/caches/paperweight/mc-dev-sources/com ./src/main/java/
cp -r ./.gradle/caches/paperweight/mc-dev-sources/net ./src/main/java/
cp -r ./.gradle/caches/paperweight/mc-dev-sources/data ./src/main/resources/
cp -r ./.gradle/caches/paperweight/mc-dev-sources/assets ./src/main/resources/
cp -r ./.gradle/caches/paperweight/mc-dev-sources/META-INF ./src/main/resources/
cp -r ./.gradle/caches/paperweight/mc-dev-sources/*.* ./src/main/resources/
git add .
git commit --fixup $(git rev-list -n 1 base)
git rebase --autosquash upstream/master
cd ..
- name: Push source changes (API)
if: startsWith(github.ref_name, 'ver/') || startsWith(github.ref_name, 'dev/')
uses: ad-m/github-push-action@master
with:
repository: PlazmaMC/sources-api
directory: ./Plazma-API
branch: plazma/${{ env.VERSION }}
github_token: ${{ secrets.GH_PAT }}
force: true
- name: Push source changes (server)
if: startsWith(github.ref_name, 'ver/') || startsWith(github.ref_name, 'dev/')
uses: ad-m/github-push-action@master
with:
repository: PlazmaMC/sources-server
directory: ./Plazma-Server
branch: plazma/${{ env.VERSION }}
github_token: ${{ secrets.GH_PAT }}
force: true
- name: Update Javadoc
if: startsWith(github.ref_name, 'ver/') || startsWith(github.ref_name, 'dev/')
continue-on-error: true
run: |
if [ ! -d "javadoc" ]; then
mkdir javadoc && cd javadoc
git init && git branch -m ${{ env.VERSION }}
cd ..
fi
cp -rf Plazma-API/build/docs/javadoc/* javadoc/
cd javadoc
git add . && git commit -m "Update Javadocs"
- name: Push source changes (javadoc)
if: startsWith(github.ref_name, 'ver/') || startsWith(github.ref_name, 'dev/')
uses: ad-m/github-push-action@master
with:
repository: PlazmaMC/Javadocs
directory: ./javadoc
branch: ${{ env.VERSION }}
github_token: ${{ secrets.GH_PAT }}
force: true
- name: Sync Javadocs Portal
if: startsWith(github.ref_name, 'ver/') || startsWith(github.ref_name, 'dev/')
continue-on-error: true
run: |
cd jdmain
if [ ! -d "${{ env.VERSION }}" ]; then
git submodule add -b ${{ env.VERSION }} https://github.com/PlazmaMC/Javadocs ${{ env.VERSION }}
fi
git submodule update
git add . && git commit -m "Update Javadocs"
- name: Push source changes (jd portal)
if: startsWith(github.ref_name, 'ver/') || startsWith(github.ref_name, 'dev/')
continue-on-error: true
uses: ad-m/github-push-action@master
with:
repository: PlazmaMC/Javadocs
directory: ./jdmain
github_token: ${{ secrets.GH_PAT }}
- name: Publish Packages
if: startsWith(github.ref_name, 'ver/') || startsWith(github.ref_name, 'dev/')
run: |
export GITHUB_USERNAME=${{ env.ORG_NAME }}
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
./gradlew publish --stacktrace
- name: Release Artifacts
if: startsWith(github.ref_name, 'ver/')
uses: softprops/action-gh-release@v2
with:
name: "Build #${{ env.BUILD_NUMBER }} for ${{ env.VERSION }}"
tag_name: "build/${{ env.VERSION }}/${{ env.BUILD_NUMBER }}"
target_commitish: ${{ github.ref_name }}
generate_release_notes: true
fail_on_unmatched_files: true
files: build/libs/*.jar
- name: Release Artifacts (Latest/Stable)
if: startsWith(github.ref_name, 'ver/')
uses: softprops/action-gh-release@v2
with:
name: "Build #${{ env.BUILD_NUMBER }} for ${{ env.VERSION }}"
tag_name: "build/${{ github.ref_name }}/latest"
target_commitish: ${{ github.ref_name }}
generate_release_notes: true
fail_on_unmatched_files: true
files: build/libs/*.jar
- name: Release Artifacts (Latest/Development)
if: startsWith(github.ref_name, 'dev/')
uses: softprops/action-gh-release@v2
with:
name: "Development Build for ${{ env.VERSION }}"
tag_name: build/${{ env.VERSION }}/latest
target_commitish: ${{ github.ref_name }}
generate_release_notes: true
fail_on_unmatched_files: true
files: build/libs/*.jar