Skip to content

Project Info #33

Project Info #33 #33

Workflow file for this run

name: Project Info
run-name: "Project Info #${{ github.run_number }}"
on:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
env:
RELEASE_TYPE: "release"
jobs:
info:
name: 🖥️ Project Info
runs-on: ubuntu-latest
outputs:
project_version: ${{ steps.project_version.outputs.tag }}
project_name: ${{ steps.project_name.outputs.value }}
project_full_name: ${{ steps.project_name.outputs.value }}-${{ steps.project_version.outputs.tag }}
changelog: ${{ steps.changelog.outputs.description }}
diff: ${{ steps.read_diff.outputs.diff }}
release_type: ${{ env.RELEASE_TYPE }}
minecraft_version: ${{ steps.minecraft_version.outputs.value }}
exists: ${{ steps.check_tag.outputs.exists }}
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: 🔍 Check pakku-lock.json
id: check_pakku_lock
shell: bash
run: |
if [ ! -f pakku-lock.json ]; then
echo "❌ Could not find pakku-lock.json" && exit 1
else
echo "✔️ pakku-lock.json"
fi
- name: 🔍 Check pakku.json
id: check_pakku
shell: bash
run: |
if [ ! -f pakku.json ]; then
echo "❌ Could not find pakku.json" && exit 1
else
echo "✔️ pakku.json"
fi
- name: 📈 Get latest tag
id: latest_tag
shell: bash
run: |
tag=$(git describe --tags --abbrev=0)
if [ -z "$tag" ]; then
echo "❌ Latest tag not found" && exit 1
else
echo "✔️ Latest tag found: $tag"
echo "tag=$tag" >> $GITHUB_OUTPUT
fi
- name: 🔍 Check pakku-lock.json in previous tag
id: check_pakku_lock_prev
shell: bash
run: |
if ! git ls-tree -r ${{ steps.latest_tag.outputs.tag }} -- ./pakku-lock.json &> /dev/null; then
echo "❌ File pakku-lock.json not found in previous tag" && exit 1
else
echo "✔️ File pakku-lock.json found in previous tag"
fi
- name: 📁 Copy pakku-lock.json from previous tag
id: copy_pakku_lock_prev
shell: bash
run: |
git show tags/${{ steps.latest_tag.outputs.tag }}:./pakku-lock.json > ./pakku-lock-prev.json
if [ -s ./pakku-lock-prev.json ]; then
echo "✔️ File pakku-lock-prev.json created"
else
echo "❌ Error: File pakku-lock-prev.json is empty or not created" && exit 1
fi
- name: 📦 Download pakku.jar
id: download_pakku
shell: bash
run: |
curl https://github.com/juraj-hrivnak/pakku/releases/latest/download/pakku.jar -o pakku.jar -L -J
echo "✔️ Downloaded pakku.jar "
- name: 🔄 Run pakku diff
id: pakku_diff
shell: bash
run: |
java -jar pakku.jar diff -v --markdown PROJECTS_DIFF.md ./pakku-lock-prev.json ./pakku-lock.json
if [ -f PROJECTS_DIFF.md ]; then
echo "✔️ Comparison completed"
else
echo "❌ Error: File PROJECTS_DIFF.md not created" && exit 1
fi
- name: 📝 Read PROJECTS_DIFF.md to variable
id: read_diff
shell: bash
run: |
echo "📝 Reading PROJECTS_DIFF.md to variable..."
{
echo 'diff<<EOF'
cat -v PROJECTS_DIFF.md
echo EOF
} >> "$GITHUB_OUTPUT"
echo "✔️ Diff content read to variable"
- name: 📊 Get Project Name
id: project_name
uses: ActionsTools/[email protected]
with:
file_path: "pakku.json"
prop_path: "name"
- name: 📊 Get Project Version
id: project_version
uses: ActionsTools/[email protected]
with:
file_path: "pakku.json"
prop_path: "version"
- name: 📊 Get Minecraft Version
id: minecraft_version
uses: ActionsTools/[email protected]
with:
file_path: "pakku-lock.json"
- run: |
echo ${{steps.minecraft_version.outputs.mc_versions}}
- name: 📄 Changelog Parser
id: changelog
uses: coditory/[email protected]
with:
path: CHANGELOG.md
- name: 📈 Upload Diff
id: upload_diff
if: ${{ steps.read_diff.outputs.diff != '' }}
uses: actions/[email protected]
with:
name: Mods-diff
path: PROJECTS_DIFF.md
- name: 🔍 Check if tag exists
uses: mukunku/[email protected]
id: check_tag
with:
tag: ${{ steps.project_version.outputs.value }}
- name: 📝 Generate Github Summary
run: |
echo "📃 **Name**: ${{ steps.project_name.outputs.value }}" >> $GITHUB_STEP_SUMMARY
echo "📃 **Release**: ${{ steps.project_version.outputs.value }}" >> $GITHUB_STEP_SUMMARY
echo "📃 **Release Type**: ${{ env.RELEASE_TYPE }}" >> $GITHUB_STEP_SUMMARY
echo "📃 **Game Version**: ${{ steps.minecraft_version.outputs.value }}" >> $GITHUB_STEP_SUMMARY
echo "${{ steps.changelog.outputs.description }}" >> $GITHUB_STEP_SUMMARY
if [ -n "${{ steps.read_diff.outputs.diff != '' }}" ]; then
echo "${{ steps.read_diff.outputs.diff }}" >> $GITHUB_STEP_SUMMARY
fi
build-modpack:
name: Build Modpack
runs-on: ubuntu-latest
needs: [info]
if: needs.info.outputs.exists != 'true'
steps:
- name: Checkout
uses: actions/[email protected]
- name: Replace strings
shell: bash
run: |
set +e
grooovy="./groovy/runConfig.json"
cat <<< $(jq '.debug = false' $grooovy) > $grooovy
VERSION=${{ needs.info.outputs.project_version }}
sed -i -e "s/DEV/${VERSION}/g" pakku.json
sed -i -e "s/DEV/${VERSION}/g" config/fancymenu/customization/gui_main_menu.txt
# - name: Cache pakku
# uses: actions/[email protected]
# with:
# path: build/.cache
# key: ${{ runner.OS }}-pakku-cache-${{ hashFiles('build/.cache/') }}
# restore-keys: ${{ runner.OS }}-pakku-cache-
- name: Export modpack
run: |
curl https://github.com/juraj-hrivnak/pakku/releases/latest/download/pakku.jar -o pakku.jar -L -J
java -jar pakku.jar export
- name: Rename artifact curseforge
run: |
cd ./build/curseforge/
mv *.zip $(basename -s .zip *.zip)-curseforge.zip
- name: Upload artifact CurseForge
uses: actions/[email protected]
with:
name: ${{ needs.info.outputs.project_full_name }}-curseforge
path: ./build/curseforge/${{ needs.info.outputs.project_full_name }}-curseforge.zip
if-no-files-found: error
- name: Rename artifact modrinth
run: |
cd ./build/modrinth/
mv *.mrpack $(basename -s .mrpack *.mrpack)-modrinth.mrpack
- name: Upload artifact modrinth
uses: actions/[email protected]
with:
name: ${{ needs.info.outputs.project_full_name }}-modrinth
path: ./build/modrinth/${{ needs.info.outputs.project_full_name }}-modrinth.mrpack
if-no-files-found: warn
build-server:
name: Build Server
runs-on: ubuntu-latest
needs: [info]
if: needs.info.outputs.exists != 'true'
steps:
- name: Checkout
uses: actions/[email protected]
- name: Replace strings
shell: bash
run: |
set +e
grooovy="./groovy/runConfig.json"
cat <<< $(jq '.debug = false' $grooovy) > $grooovy
VERSION=${{ needs.info.outputs.project_version }}
sed -i -e "s/DEV/${VERSION}/g" pakku.json
sed -i -e "s/DEV/${VERSION}/g" config/fancymenu/customization/gui_main_menu.txt
# - name: Cache pakku
# uses: actions/[email protected]
# with:
# path: build/.cache
# key: ${{ runner.OS }}-pakku-cache-${{ hashFiles('build/.cache/') }}
# restore-keys: ${{ runner.OS }}-pakku-cache-
- name: Export modpack
run: |
mv -vf ./.pakku/server-overrides/* ./
curl https://github.com/juraj-hrivnak/pakku/releases/latest/download/pakku.jar -o pakku.jar -L -J
java -jar pakku.jar export
- name: Rename artifact server
run: |
cd ./build/serverpack/
mv *.zip $(basename -s .zip *.zip)-serverpack.zip
- name: Upload artifact server
uses: actions/[email protected]
with:
name: ${{ needs.info.outputs.project_full_name }}-serverpack
path: ./build/serverpack/${{ needs.info.outputs.project_full_name }}-serverpack.zip
if-no-files-found: error
build-multimc:
name: Build MultiMC
runs-on: ubuntu-latest
needs: [info]
if: needs.info.outputs.exists != 'true'
steps:
- name: Checkout
uses: actions/[email protected]
- name: Replace strings
shell: bash
run: |
set +e
grooovy="./groovy/runConfig.json"
cat <<< $(jq '.debug = false' $grooovy) > $grooovy
VERSION=${{ needs.info.outputs.project_version }}
sed -i -e "s/DEV/${VERSION}/g" pakku.json
sed -i -e "s/DEV/${VERSION}/g" config/fancymenu/customization/gui_main_menu.txt
sed -i -e "s/DEV/${VERSION}/g" .pakku/multimc-overrides/instance.cfg
# - name: Cache pakku
# uses: actions/[email protected]
# with:
# path: build/.cache
# key: ${{ runner.OS }}-pakku-cache-${{ hashFiles('build/.cache/') }}
# restore-keys: ${{ runner.OS }}-pakku-cache-
- name: Export
run: |
curl https://github.com/juraj-hrivnak/pakku/releases/latest/download/pakku.jar -o pakku.jar -L -J
java -jar pakku.jar --debug fetch
java -jar pakku.jar --debug export
- name: Move files
run: |
ls
mkdir -p .pakku/multimc-overrides/flame
mv -vf ./build/.cache/curseforge/manifest.json .pakku/multimc-overrides/flame/manifest.json
mv -vf ./build/.cache/curseforge/overrides .pakku/multimc-overrides/.minecraft
mv -vf ./mods .pakku/multimc-overrides/.minecraft/mods
cd .pakku/multimc-overrides/
zip -r ${{ needs.info.outputs.project_full_name }}-multimc.zip icon.png mmc-pack.json instance.cfg .minecraft/ flame/
- name: Upload zip multimc
uses: actions/[email protected]
with:
name: ${{ needs.info.outputs.project_full_name }}-multimc
path: .pakku/multimc-overrides/${{ needs.info.outputs.project_full_name }}-multimc.zip
if-no-files-found: error