Skip to content

Commit

Permalink
Update build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Xikaro committed Dec 21, 2024
1 parent 38f9bcd commit 9935410
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,49 +55,50 @@ 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
echo "✔️ Downloaded pakku.jar "
- 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
Expand All @@ -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..."
Expand Down

0 comments on commit 9935410

Please sign in to comment.