Skip to content

Commit

Permalink
Fix auto deploy CI (#147)
Browse files Browse the repository at this point in the history
* Fix auto deploy CI

* Test CI

* Mark check-deploy as executable

* Revert test CI change

* Simplify
  • Loading branch information
FrederikBolding authored Jan 31, 2024
1 parent 926d1c2 commit 5c0a105
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/auto-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,27 @@ name: Auto Deploy

on:
schedule:
- cron: '0 0 * * *'
- cron: "0 0 * * *"

jobs:
check:
runs-on: ubuntu-latest
outputs:
deploy: ${{ steps.set-output.outputs.deploy }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check if deployment is needed
id: set-output
shell: bash
env:
BUILD_HOOK: ${{ secrets.NETLIFY_BUILD_HOOK }}
run: ./scripts/check-deploy.sh

deploy:
needs: check
if: needs.check.outputs.deploy == 'true'
name: Publish to the `gh-pages` branch
permissions:
contents: write
uses: ./.github/workflows/publish.yml
with:
destination_dir: ./
5 changes: 2 additions & 3 deletions scripts/check-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ shouldDeploy=$(curl -s https://api.github.com/repos/ethereum-lists/chains/commit

if [ $shouldDeploy -eq 0 ]
then
echo "Deploying..."
curl -X POST -d '{}' https://api.netlify.com/build_hooks/${BUILD_HOOK}
echo "deploy=true" >> "$GITHUB_OUTPUT"
else
echo "No deploy needed"
echo "deploy=false" >> "$GITHUB_OUTPUT"
fi

0 comments on commit 5c0a105

Please sign in to comment.