Skip to content

add eagler textures

add eagler textures #4

Workflow file for this run

name: Publish Pack
on:
workflow_dispatch:
push:
permissions:
contents: write
actions: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Get Pack Meta
id: meta
run: |
NAME=$(jq -r '.name' pack_meta.json)
VERSION=$(jq -r '.version' pack_meta.json)
MC=$(jq -r '.mc_version' pack_meta.json)
SUPPORTED_MC=$(jq -rc '.supported_mc_versions' pack_meta.json)
PACK_ID=${VERSION}+mc${MC}
echo "PACK_NAME=$NAME" >> "$GITHUB_OUTPUT"
echo "PACK_VERSION=$VERSION" >> "$GITHUB_OUTPUT"
echo "MC_VERSION=$MC" >> "$GITHUB_OUTPUT"
echo "SUPPORTED_MC_VERSIONS=$SUPPORTED_MC" >> "$GITHUB_OUTPUT"
echo "PACK_ID=$PACK_ID" >> "$GITHUB_OUTPUT"
echo "PACK_FILENAME=${NAME}_${PACK_ID}.zip" >> "$GITHUB_OUTPUT"
echo "COMMIT_SHORT_HASH=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- name: Zip Pack
run: |
mkdir -p dist
cd src
zip -r ../dist/${{ steps.meta.outputs.PACK_FILENAME }} ./
- name: Upload Pack
uses: actions/upload-artifact@v4
with:
name: ${{ steps.meta.outputs.PACK_FILENAME }}
path: dist/${{ steps.meta.outputs.PACK_FILENAME }}
- name: Check GitHub Release Tag
id: ghcheck
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
CODE=$(curl -s -o /dev/null -w "%{http_code}" \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ steps.meta.outputs.PACK_ID }}")
[ "$CODE" = "200" ] && EXISTS=true || EXISTS=false
echo "EXISTS=$EXISTS" >> "$GITHUB_OUTPUT"
- name: Create Release
if: ${{ steps.ghcheck.outputs.EXISTS != 'true' }}
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.meta.outputs.PACK_ID }}
name: ${{ steps.meta.outputs.PACK_NAME }} ${{ steps.meta.outputs.PACK_VERSION }} for Minecraft ${{ steps.meta.outputs.MC_VERSION }}
files: dist/${{ steps.meta.outputs.PACK_FILENAME }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Has Modrinth Token
id: hastoken
env:
TOKEN: ${{ secrets.MODRINTH_TOKEN }}
run: |
echo "EXISTS=$([ -n "$TOKEN" ] && echo true || echo false)" >> "$GITHUB_OUTPUT"
- name: Fetch Modrinth Info
id: modrinthinfo
if: ${{ steps.hastoken.outputs.EXISTS == 'true' }}
env:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
run: |
PROJECT_ID=$(curl -s "https://api.modrinth.com/v2/project/legacy-mc-tweaks" -H "Authorization: Bearer $MODRINTH_TOKEN" | jq -r '.id')
VERSION_EXISTS=$(curl -s -H "User-Agent: github-actions" "https://api.modrinth.com/v2/project/${PROJECT_ID}/version" -H "Authorization: Bearer $MODRINTH_TOKEN" | jq -r --arg v "${{ steps.meta.outputs.PACK_ID }}" 'if type == "array" then any(.[]; (.version_number? // "") == $v) else false end')
echo "PROJECT_ID=$PROJECT_ID" >> "$GITHUB_OUTPUT"
echo "VERSION_EXISTS=$VERSION_EXISTS" >> "$GITHUB_OUTPUT"
- name: Publish Pack to Modrinth
uses: cloudnode-pro/modrinth-publish@v2
if: ${{ steps.hastoken.outputs.EXISTS == 'true' && steps.modrinthinfo.outputs.VERSION_EXISTS != 'true' }}
with:
token: ${{ secrets.MODRINTH_TOKEN }}
project: ${{ steps.modrinthinfo.outputs.PROJECT_ID }}
name: ${{ steps.meta.outputs.PACK_NAME }}
version: ${{ steps.meta.outputs.PACK_ID }}
files: '["dist/${{ steps.meta.outputs.PACK_FILENAME }}"]'
primary-file: ${{ steps.meta.outputs.PACK_FILENAME }}
game-versions: "${{ steps.meta.outputs.SUPPORTED_MC_VERSIONS }}"
loaders: '["minecraft"]'