Skip to content

Commit

Permalink
Update build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
tzagim authored Jul 25, 2024
1 parent 5310dee commit 01beaef
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@ name: Build pif
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: "*/30 * * * *"

jobs:
build:
runs-on: ubuntu-latest
outputs:
start_relase: ${{ steps.differencescheck.outputs.value }}
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -27,34 +23,37 @@ jobs:
run: ./pif.sh

- name: Check differences in custom.pif.json
id: differencescheck
run: |
if git diff --exit-code custom.pif.json; then
echo "custom.pif.json is the same, no need to commit."
elif
git diff | grep -P '.*MANUFACTURER.*null.*'; then
echo "Something is wrong with the new custom.pif.json, not commit."
echo "value=none" >> $GITHUB_ENV
elif git diff | grep -v '"FIRST_API_LEVEL": "null"' | grep '"null"'; then
echo "Something is wrong with the new custom.pif.json, not committing."
echo "status=error" >> $GITHUB_ENV
else
echo "value=build" >> "$GITHUB_OUTPUT"
echo "NOW=$(date +'%Y.%m.%d')" >> $GITHUB_ENV
cat custom.pif.json
echo "status=build" >> $GITHUB_ENV
fi
- name: Update custom.pif.json
if: env.status == 'build'
run: |
echo "date=$(date +'%Y.%m.%d')" >> $GITHUB_ENV
git config --global user.name "tzagim"
git config --global user.email "[email protected]"
git add custom.pif.json
git commit -m "Update custom.pif.json"
git push
fi
- name: 🔖 Create Github Release
- name: 🔖 Create GitHub Release
uses: softprops/action-gh-release@v2
if: steps.differencescheck.outputs.value == 'build'
if: env.status == 'build'
with:
tag_name: ${{ env.NOW }}
tag_name: ${{ env.date }}
files: custom.pif.json

- name: 🔖 Upload artifact
uses: actions/upload-artifact@v4
if: steps.differencescheck.outputs.value == 'build'
if: env.status == 'build'
with:
name: custom.pif.json
path: custom.pif.json
Expand Down

0 comments on commit 01beaef

Please sign in to comment.