Project Info #25 #25
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: Project Info | |
run-name: "Project Info #${{ github.run_number }}" | |
env: | |
RELEASE_TYPE: "release" | |
MINECRAFT_VERSION: "1.12.2" | |
on: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
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.check.outputs.diff }} | |
release_type: ${{ env.RELEASE_TYPE }} | |
minecraft_version: ${{ env.MINECRAFT_VERSION }} | |
exists: ${{ steps.check_tag.outputs.exists }} | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
- name: Check file | |
id: check | |
shell: bash | |
run: | | |
set +e | |
echo "🔎 Getting modpack info..." | |
# Проверяем, существет ли pakku-lock.json | |
if [ ! -f pakku-lock.json ]; then | |
echo "❌ Could not find pakku-lock.json" && exit 1 | |
else | |
echo "✔️ pakku-lock.json" | |
fi | |
# Проверяем, существет ли pakku.json | |
if [ ! -f pakku.json ]; then | |
echo "❌ Could not find pakku.json" && exit 1 | |
else | |
echo "✔️ pakku.json" | |
fi | |
# Получаем последний тег | |
latest_tag=$(git describe --tags --abbrev=0) | |
if [ -z "$latest_tag" ]; then | |
echo "❌ Latest tag not found" && exit 1 | |
else | |
echo "✔️ Latest tag found: $latest_tag" | |
fi | |
# Проверяем, существует ли файл pakku-lock.json в предыдущем теге | |
if ! git ls-tree -r $latest_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 | |
# Копируем файл pakku-lock.json из предыдущего тега в текущий каталог | |
git show tags/$latest_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 | |
# Качаем последний пакет pakku | |
curl https://github.com/juraj-hrivnak/pakku/releases/latest/download/pakku.jar -o pakku.jar -L -J | |
echo "✔️ Downloaded pakku.jar " | |
# Выполняем сравнение пакетов с помощью пакета pakku.jar | |
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 | |
echo "📝 Formatting PROJECTS_DIFF.md..." | |
{ | |
echo 'diff<<EOF' | |
cat -v PROJECTS_DIFF.md | |
echo EOF | |
} >> "$GITHUB_OUTPUT" | |
echo "✔️ Formatting completed" | |
- 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: Changelog Parser | |
id: changelog | |
uses: coditory/[email protected] | |
with: | |
path: CHANGELOG.md | |
- name: Upload Diff | |
id: diff | |
if: ${{ steps.check.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**: ${{ env.MINECRAFT_VERSION }}" >> $GITHUB_STEP_SUMMARY | |
echo "${{ steps.changelog.outputs.description }}" >> $GITHUB_STEP_SUMMARY | |
if [ -n "${{ steps.check.outputs.diff != '' }}" ]; then | |
echo "${{ steps.check.outputs.diff }}" >> $GITHUB_STEP_SUMMARY | |
fi | |
build: | |
needs: [info] | |
if: needs.info.outputs.exists != 'true' | |
uses: ./.github/workflows/build.yml | |
with: | |
project_version: ${{ needs.info.outputs.project_version }} | |
project_name: ${{ needs.info.outputs.project_name }} | |
project_full_name: ${{ needs.info.outputs.project_full_name }} | |
changelog: ${{ needs.info.outputs.changelog }} | |
diff: ${{ needs.info.outputs.diff }} | |
release_type: ${{ needs.info.outputs.release_type }} | |
minecraft_version: ${{ needs.info.outputs.minecraft_version }} | |
secrets: inherit |