Skip to content

Commit

Permalink
Fix auto deploy CI
Browse files Browse the repository at this point in the history
  • Loading branch information
FrederikBolding committed Jan 31, 2024
1 parent 926d1c2 commit 4ae9500
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
22 changes: 19 additions & 3 deletions .github/workflows/auto-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,32 @@ 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

build:
needs: check
if: needs.check.outputs.deploy == 'true'
name: Build
uses: ./.github/workflows/build.yml

deploy:
needs: build
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
100755 → 100644
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 4ae9500

Please sign in to comment.