From 99354102dde697763d4b095e3facadfe2743ca70 Mon Sep 17 00:00:00 2001 From: Xikaro <0regon.end@gmail.com> Date: Sat, 21 Dec 2024 13:55:07 +0500 Subject: [PATCH] Update build.yml --- .github/workflows/build.yml | 41 +++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4353ed570..2b35db9d9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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..."