mirror of
https://github.com/GTNewHorizons/Postea.git
synced 2026-11-19 19:59:39 +00:00
Use shared github actions workflows (#35)
* Use shared github actions workflows * Oops, switched the conditions around Co-authored-by: Connor-Colenso <[email protected]>
This commit is contained in:
1 parent
4bee2db5a4
commit
87e65c226a
5 files changed
+24
-207
No files matched your search
@@ -1,51 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# bashsupport disable=BP5006 # Global environment variables
|
||||
RUNDIR="run" \
|
||||
CRASH="crash-reports" \
|
||||
SERVERLOG="server.log"
|
||||
|
||||
# enable nullglob to get 0 results when no match rather than the pattern
|
||||
shopt -s nullglob
|
||||
|
||||
# store matches in array
|
||||
crash_reports=("$RUNDIR/$CRASH/crash"*.txt)
|
||||
|
||||
# if array not empty there are crash_reports
|
||||
if [ "${#crash_reports[@]}" -gt 0 ]; then
|
||||
# get the latest crash_report from array
|
||||
latest_crash_report="${crash_reports[-1]}"
|
||||
{
|
||||
printf 'Latest crash report detected %s:\n' "${latest_crash_report##*/}"
|
||||
cat "$latest_crash_report"
|
||||
} >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if grep --quiet --fixed-strings 'Fatal errors were detected' "$SERVERLOG"; then
|
||||
{
|
||||
printf 'Fatal errors detected:\n'
|
||||
cat server.log
|
||||
} >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if grep --quiet --fixed-strings 'The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED' \
|
||||
"$SERVERLOG"; then
|
||||
{
|
||||
printf 'Server force stopped:'
|
||||
cat server.log
|
||||
} >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! grep --quiet --perl-regexp --only-matching '.+Done \(.+\)\! For help, type "help" or "\?"' "$SERVERLOG"; then
|
||||
{
|
||||
printf 'Server did not finish startup:'
|
||||
cat server.log
|
||||
} >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf 'No crash reports detected'
|
||||
exit 0
|
||||
@@ -1,5 +1,3 @@
|
||||
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
|
||||
|
||||
name: Build and test
|
||||
|
||||
@@ -11,35 +9,5 @@ on:
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up JDK 8
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: '8'
|
||||
distribution: 'adopt'
|
||||
cache: gradle
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
|
||||
- name: Setup the workspace
|
||||
run: ./gradlew setupCIWorkspace
|
||||
|
||||
- name: Build the mod
|
||||
run: ./gradlew build
|
||||
|
||||
- name: Run server for 1.5 minutes
|
||||
run: |
|
||||
mkdir run
|
||||
echo "eula=true" > run/eula.txt
|
||||
timeout 90 ./gradlew runServer 2>&1 | tee -a server.log || true
|
||||
|
||||
- name: Test no errors reported during server run
|
||||
run: |
|
||||
chmod +x .github/scripts/test_no_error_reports
|
||||
.github/scripts/test_no_error_reports
|
||||
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/build-and-test.yml@master
|
||||
secrets: inherit
|
||||
@@ -1,73 +0,0 @@
|
||||
# This workflow only meant for the source mod you shouldn't bring it into your own project
|
||||
|
||||
name: Release starter and migration packages
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
zip-and-release-packages:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set release version
|
||||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
||||
|
||||
- name: Prepare release folder
|
||||
run: |
|
||||
mkdir packages
|
||||
|
||||
- name: Zip starter
|
||||
uses: montudor/action-zip@v1
|
||||
with:
|
||||
args: >
|
||||
zip -r packages/starter.zip . \
|
||||
\
|
||||
-x "*.git/*" \
|
||||
\
|
||||
-x ".github/scripts/update-version.sh" \
|
||||
-x ".github/workflows/buildscript-maintenance.yml" \
|
||||
-x ".github/workflows/release-packages-latest.yml" \
|
||||
-x ".github/workflows/toolchain-compatibility.yml" \
|
||||
\
|
||||
-x "*docs/*" \
|
||||
-x "README.md" \
|
||||
-x "LICENSE" \
|
||||
\
|
||||
-x "packages/starter.zip" \
|
||||
-x "packages/migration.zip"
|
||||
|
||||
- name: Zip migration
|
||||
uses: montudor/action-zip@v1
|
||||
with:
|
||||
args: >
|
||||
zip -r packages/migration.zip . \
|
||||
\
|
||||
-x "*.git/*" \
|
||||
\
|
||||
-x ".github/scripts/update-version.sh" \
|
||||
-x ".github/workflows/buildscript-maintenance.yml" \
|
||||
-x ".github/workflows/release-packages-latest.yml" \
|
||||
-x ".github/workflows/release-packages-tags.yml" \
|
||||
-x ".github/workflows/toolchain-compatibility.yml" \
|
||||
\
|
||||
-x "*docs/*" \
|
||||
-x "*src/*" \
|
||||
-x "LICENSE" \
|
||||
-x "README.md" \
|
||||
\
|
||||
-x "packages/starter.zip" \
|
||||
-x "packages/migration.zip"
|
||||
|
||||
- name: Release under current tag
|
||||
uses: "marvinpinto/action-automatic-releases@latest"
|
||||
with:
|
||||
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
automatic_release_tag: "${{ env.RELEASE_VERSION }}-packages"
|
||||
prerelease: false
|
||||
title: "${{ env.RELEASE_VERSION }} starter and migration packages"
|
||||
files: packages/*
|
||||
+15
-5
@@ -6,6 +6,7 @@ name: Release latest starter and migration packages
|
||||
on:
|
||||
push:
|
||||
branches: [ master, main ]
|
||||
tags: [ '*' ]
|
||||
|
||||
jobs:
|
||||
zip-and-release-packages:
|
||||
@@ -31,8 +32,7 @@ jobs:
|
||||
\
|
||||
-x ".github/scripts/update-version.sh" \
|
||||
-x ".github/workflows/buildscript-maintenance.yml" \
|
||||
-x ".github/workflows/release-packages-latest.yml" \
|
||||
-x ".github/workflows/release-packages-tags.yml" \
|
||||
-x ".github/workflows/release-packages.yml" \
|
||||
\
|
||||
-x "*docs/*" \
|
||||
-x "README.md" \
|
||||
@@ -51,8 +51,7 @@ jobs:
|
||||
\
|
||||
-x ".github/scripts/update-version.sh" \
|
||||
-x ".github/workflows/buildscript-maintenance.yml" \
|
||||
-x ".github/workflows/release-packages-latest.yml" \
|
||||
-x ".github/workflows/release-packages-tags.yml" \
|
||||
-x ".github/workflows/release-packages.yml" \
|
||||
\
|
||||
-x "*docs/*" \
|
||||
-x "*src/*" \
|
||||
@@ -64,9 +63,20 @@ jobs:
|
||||
|
||||
- name: Update latest tag
|
||||
uses: "marvinpinto/action-automatic-releases@latest"
|
||||
if: ${{ (github.ref == 'master' || github.ref == 'main') }}
|
||||
with:
|
||||
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
automatic_release_tag: "latest-packages"
|
||||
prerelease: false
|
||||
prerelease: true
|
||||
title: "Latest starter and migration packages"
|
||||
files: packages/*
|
||||
|
||||
- name: Release named version
|
||||
if: ${{ !(github.ref == 'master' || github.ref == 'main') }}
|
||||
uses: "marvinpinto/action-automatic-releases@latest"
|
||||
with:
|
||||
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
automatic_release_tag: "${{ env.RELEASE_VERSION }}-packages"
|
||||
prerelease: false
|
||||
title: "${{ env.RELEASE_VERSION }} starter and migration packages"
|
||||
files: packages/*
|
||||
@@ -1,51 +1,14 @@
|
||||
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
|
||||
|
||||
name: Release tagged build
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
tags: [ '*' ]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set release version
|
||||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
||||
|
||||
- name: Set up JDK 8
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: '8'
|
||||
distribution: 'adopt'
|
||||
cache: gradle
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
|
||||
- name: Setup the workspace
|
||||
run: ./gradlew setupCIWorkspace
|
||||
|
||||
- name: Build the mod
|
||||
run: ./gradlew build
|
||||
|
||||
- name: Release under current tag
|
||||
uses: "marvinpinto/action-automatic-releases@latest"
|
||||
with:
|
||||
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
automatic_release_tag: "${{ env.RELEASE_VERSION }}"
|
||||
prerelease: false
|
||||
title: "${{ env.RELEASE_VERSION }}"
|
||||
files: build/libs/*.jar
|
||||
|
||||
- name: Publish to Maven
|
||||
run: ./gradlew publish
|
||||
env:
|
||||
MAVEN_USER: ${{ secrets.MAVEN_USER }}
|
||||
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
|
||||
release-tags:
|
||||
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/release-tags.yml@master
|
||||
secrets: inherit
|
||||
Reference in new issue
Block a user