Revert "1.20.2-pre4" #347
This file contains 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: Server builds | |
on: | |
push: | |
branches: | |
- '**' | |
tags: | |
- '**' | |
pull_request: | |
branches: | |
- '**' | |
workflow_dispatch: | |
jobs: | |
create-release: | |
needs: test | |
runs-on: ubuntu-latest | |
if: ${{ format('refs/heads/{0}', github.event.repository.default_branch) == github.ref || 'refs/heads/dev/mc-update' == github.ref}} | |
#This permission is needed to push a release (and/or tags) | |
permissions: | |
contents: write #nessesary for tag creation and release creation | |
actions: write #nessesary for cache deletion | |
packages: write #packages write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Get Version Name | |
id: version_name | |
run: | | |
echo version=${GITHUB_REF#refs/tags/v} >> $GITHUB_OUTPUT | |
- name: Download build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: artifacts | |
- name: Rename and move artifacts | |
run: | | |
for dir in artifacts/*/ | |
do | |
dir=${dir%*/} # remove the trailing "/" | |
for file in $dir/* | |
do | |
echo "moving $file one folder higher" | |
mv $file artifacts/ | |
done | |
rm -r "${dir}" | |
done | |
for archive in artifacts/*.tar.* | |
do | |
tar -xvf $archive -C artifacts | |
rm $archive | |
done | |
#PLEASE ALWAYS regen library hashes!!! | |
rm -f projects/ketting/build/ketting_libraries.txt | |
- name: Setup Java 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Cache .gradle | |
uses: burrunan/gradle-cache-action@v1 | |
with: | |
# Enable concurrent cache save and restore | |
# Default is concurrent=false for better log readability | |
concurrent: true | |
# Disable caching of $HOME/.gradle/caches/*.*/generated-gradle-jars | |
save-generated-gradle-jars: false | |
# Disable publishing Gradle Build Scan URL to job report | |
gradle-build-scan-report: false | |
- name: Restore Project Sources for faster setup | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
projects/ | |
key: project-src-cache-sha-${{ github.ref }}-${{ github.sha }} | |
restore-keys: project-src-cache- | |
- name: Setup Gradle | |
uses: gradle/[email protected] | |
- name: Setup Ketting | |
run: ./gradlew setup | |
- name: Publish Ketting | |
run: ./gradlew publish --stacktrace --info | |
env: | |
KETTINGUSERNAME: ${{ secrets.KETTINGUSERNAME }} | |
KETTINGPASSWORD: ${{ secrets.KETTINGPASSWORD }} | |
VERSION: ${{ steps.version_name.outputs.version }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Tag repo | |
id: tag | |
run: | | |
function getVer(){ | |
IFS='=' read -ra ARR <<<$(grep $1 gradle.properties) | |
read -r -d '' "$1" <<< ${ARR[1]} | |
unset IFS | |
unset ARR | |
} | |
getVer MC_VERSION | |
getVer FORGE_VERSION | |
getVer KETTING_VERSION | |
tag=v$MC_VERSION-$FORGE_VERSION-$KETTING_VERSION | |
echo "tag=$tag" >> "$GITHUB_OUTPUT" | |
git tag $tag | |
git push origin $tag | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Github Release if on default branch | |
if: false | |
# if: ${{ format('refs/heads/{0}', github.event.repository.default_branch) == github.ref }} | |
env: | |
TAG: ${{ steps.tag.outputs.tag }} | |
run: | | |
gh release create "$TAG" artifacts/* \ | |
--repo="$GITHUB_REPOSITORY" \ | |
--title="${GITHUB_REPOSITORY#*/} ${TAG#v}" \ | |
--generate-notes | |
- name: Delete Project Sources for build | |
run: | | |
gh extension install actions/gh-actions-cache | |
REPO=${{ github.repository }} | |
BRANCH=${{ github.ref }} | |
echo "Deleting caches..." | |
## Setting this to not fail the workflow while deleting cache keys. | |
#set +e | |
gh actions-cache delete project-src-cache-${{ github.ref }}-${{ github.sha }} -R $REPO -B $BRANCH --confirm | |
echo "Done" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Get Version Name | |
id: version_name | |
run: | | |
echo version=${GITHUB_REF#refs/tags/v} >> $GITHUB_OUTPUT | |
- name: Rename Branch, if Pull_Request | |
if: ${{ github.event_name == 'pull_request' }} | |
run: git checkout -B 'branch' | |
- name: Setup Java 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Cache .gradle | |
uses: burrunan/gradle-cache-action@v1 | |
with: | |
# Enable concurrent cache save and restore | |
# Default is concurrent=false for better log readability | |
concurrent: true | |
# Disable caching of $HOME/.gradle/caches/*.*/generated-gradle-jars | |
save-generated-gradle-jars: false | |
# Disable publishing Gradle Build Scan URL to job report | |
gradle-build-scan-report: false | |
- name: Restore Project Sources for faster setup | |
id: cache_projects-src_restore | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
projects/ | |
key: project-src-cache-${{ hashFiles('patches/**', 'src/main/resources/META-INF/accesstransformer.cfg') }} | |
restore-keys: | | |
project-src-cache- | |
- name: Delete old jar's | |
run: rm -f */*/build/libs/*.jar | |
- name: Rename Branch, if Pull_Request | |
if: ${{ github.event_name == 'pull_request' }} | |
run: git checkout -B 'branch' | |
- name: Validate Gradle wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
- name: Setup Ketting, Check Setup Ketting & Generate KettingJar | |
run: ./gradlew setup build kettingJar | |
env: | |
VERSION: ${{ steps.version_name.outputs.version }} | |
- name: Put ketting jar in an archive | |
working-directory: projects/ketting/build/libs | |
run: | | |
tar -czf ketting.tar.gz ketting*.jar | |
mv ketting.tar.gz ../../../../ | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ketting-server | |
path: | | |
ketting.tar.gz | |
- name: Save Project Sources | |
if: steps.cache_projects-src_restore.outputs.cache-hit != 'true' | |
uses: actions/cache/save@v3 | |
with: | |
path: | | |
projects/ | |
key: ${{ steps.cache_projects-src_restore.outputs.cache-primary-key }} | |
- name: Save Project Sources for publish | |
if: github.ref_type == 'tag' | |
uses: actions/cache/save@v3 | |
with: | |
path: | | |
projects/ | |
key: project-src-cache-sha-${{ github.ref }}-${{ github.sha }} | |
test: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Setup Java 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Download build artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: ketting-server | |
path: . | |
- name: Extract Ketting-Server | |
run: | | |
tar -xvf ketting.tar.gz | |
- name: Test Simple Server Start&Stop | |
timeout-minutes: 10 | |
run: echo "stop" | java -Dforge.enableGameTest=true -jar ketting*.jar -dau -accepteula |