Update build.yml

This commit is contained in:
Xikaro 2024-12-21 13:55:07 +05:00
parent 38f9bcd367
commit 99354102dd

View file

@ -55,41 +55,42 @@ jobs:
else
echo "✔️ pakku.json"
fi
- name: 📈 Latest & Previous Tag
id: tag
uses: JinoArch/get-latest-tag@latest
- name: 📈 Get latest tag
id: latest_tag
- name: 🔍 Check pakku-lock.json in previous tag
id: check_pakku_lock_prev
shell: bash
run: |
tag=$(git describe --tags --abbrev=0)
if [ -z "$tag" ]; then
echo "❌ Latest tag not found" && exit 1
if ! git ls-tree -r ${{ steps.tag.outputs.latestTag }} -- ./pakku-lock.json &> /dev/null; then
echo "❌ File pakku-lock.json not found in previous tag"
else
echo "✔️ Latest tag found: $tag"
echo "tag=$tag" >> $GITHUB_OUTPUT
echo "✔️ File pakku-lock.json found in previous tag"
fi
- name: 🔍 Check and copy pakku-lock.json from previous tag
- name: 📁 Check and copy pakku-lock.json from previous tag
id: check_copy_lock
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"
echo "file_found=false" >> $GITHUB_OUTPUT
git show tags/${{ steps.tag.outputs.latestTag }}:./pakku-lock.json > ./pakku-lock-prev.json
if [ -s ./pakku-lock-prev.json ]; then
echo "✔️ File pakku-lock-prev.json created"
else
echo "✔️ File pakku-lock.json found in previous tag"
git show ${{ steps.latest_tag.outputs.tag }}:./pakku-lock.json > ./pakku-lock-prev.json
echo "❌ Error: File pakku-lock-prev.json is empty or not created"
echo "Creating pakku-lock-prev.json from current repository file"
cp ./pakku-lock.json ./pakku-lock-prev.json
if [ -s ./pakku-lock-prev.json ]; then
echo "✔️ File pakku-lock-prev.json created"
echo "file_found=true" >> $GITHUB_OUTPUT
echo "✔️ File pakku-lock-prev.json created from current repository file"
else
echo "❌ Error: File pakku-lock-prev.json is empty or not created"
echo "file_found=false" >> $GITHUB_OUTPUT
echo "❌ Error: Failed to create pakku-lock-prev.json from current repository file"
fi
fi
- name: 📦 Download pakku.jar
id: download_pakku
if: steps.check_copy_lock.outputs.file_found == 'true'
if: steps.check_pakku_lock_prev.outputs.file_found == 'true'
shell: bash
run: |
curl https://github.com/juraj-hrivnak/pakku/releases/latest/download/pakku.jar -o pakku.jar -L -J
@ -97,7 +98,7 @@ jobs:
- name: 🔄 Run pakku diff
id: pakku_diff
if: steps.check_copy_lock.outputs.file_found == 'true'
if: steps.check_pakku_lock_prev.outputs.file_found == 'true'
shell: bash
run: |
java -jar pakku.jar diff -v --markdown PROJECTS_DIFF.md ./pakku-lock-prev.json ./pakku-lock.json
@ -109,7 +110,7 @@ jobs:
- name: 📝 Read PROJECTS_DIFF.md to variable
id: read_diff
if: steps.check_copy_lock.outputs.file_found == 'true'
if: steps.check_pakku_lock_prev.outputs.file_found == 'true'
shell: bash
run: |
echo "📝 Reading PROJECTS_DIFF.md to variable..."