diff --git a/.github/workflows/auto-deploy.yml b/.github/workflows/auto-deploy.yml index 262171653..74412d08d 100644 --- a/.github/workflows/auto-deploy.yml +++ b/.github/workflows/auto-deploy.yml @@ -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: ./ diff --git a/scripts/check-deploy.sh b/scripts/check-deploy.sh index 81f88c172..f06c51c11 100755 --- a/scripts/check-deploy.sh +++ b/scripts/check-deploy.sh @@ -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