update #24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: update | |
on: | |
schedule: | |
- cron: '42 0 * * 1' | |
workflow_dispatch: | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Update | |
run: | | |
./update.sh | |
- name: Install SSH Client | |
uses: webfactory/ssh-agent@v0.9.0 | |
with: | |
ssh-private-key: ${{ secrets.DEPLOY_KEY }} | |
- name: Commit changes | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
git config --global user.email "${GITHUB_REPOSITORY#*/}@${GITHUB_REPOSITORY%/*}.github.io" | |
git config --global user.name "${GITHUB_JOB} Github Action" | |
git remote add deploy git@github.com:${GITHUB_REPOSITORY}.git | |
git checkout main | |
git commit -a -m "Self-update" | |
git push deploy main | |
else | |
echo "No changes to commit" | |
fi | |
- name: Notify NodePing | |
env: | |
NODEPING_CHECKTOKEN: ${{ secrets.NODEPING_CHECKTOKEN }} | |
NODEPING_ID: ${{ secrets.NODEPING_ID }} | |
if: ${{ github.event_name == 'schedule' }} | |
run: | | |
if [ "${NODEPING_CHECKTOKEN}" != "" ] && [ "${NODEPING_ID}" != "" ]; then | |
curl \ | |
--silent \ | |
--request POST \ | |
"https://push.nodeping.com/v1?id=${NODEPING_ID}&checktoken=${NODEPING_CHECKTOKEN}" | |
else | |
echo "WARNING: nodeping not configured for update-data" | |
fi |