Skip to content

Check for docs updates #2069

Check for docs updates

Check for docs updates #2069

Workflow file for this run

name: Check for docs updates
on:
workflow_dispatch: {}
repository_dispatch:
types: [docs-update]
schedule:
# run this during the week, tuesday to friday
# at 9:10am, 9:10pm
# Redmond time (UTC-7)
- cron: '10 16,4 * * 2-5'
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
jobs:
check:
if: github.repository == 'bedrock-dot-dev/docs' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: Checkout πŸ›ŽοΈ
uses: actions/checkout@v3
- name: Setup Python 🐍
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
- name: Install dependencies βš™οΈ
run: |
pip install -r scripts/requirements.txt
- name: Setup git environment βš™οΈ
run: |
git config --global user.name 'destruc7i0n'
git config --global user.email '[email protected]'
- name: Check for docs update πŸ”Ž
id: check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd scripts
python3 update.py
- name: Update summary πŸ“
run: |
echo "### Check output πŸ—’οΈ" >> $GITHUB_STEP_SUMMARY
echo "Update found: ${{ (steps.check.outputs.update == 'true' && 'βœ…') || '❌' }}" >> $GITHUB_STEP_SUMMARY
echo 'JSON output: `${{ steps.check.outputs.release_data }}`' >> $GITHUB_STEP_SUMMARY
if [ "${{ steps.check.outputs.update }}" == "true" ]; then
echo 'Commit message: ${{ steps.check.outputs.msg }}' >> $GITHUB_STEP_SUMMARY
fi
- name: Send Discord message πŸ””
if: steps.check.outputs.update == 'true'
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
run: |
LAST_COMMIT_SHA=$(git rev-parse HEAD)
jq -nr '{
"content": null,
"embeds": [
{
"title": "Docs update: **${{ steps.check.outputs.msg }}**",
"url": "https://github.com/${{ github.repository }}/commit/'"$LAST_COMMIT_SHA"'",
}
],
"username": "bedrock.dev",
"avatar_url": "https://bedrock.dev/favicon/android-chrome-512x512.png",
}' | curl -X POST -H "Content-Type: application/json" -d @- $DISCORD_WEBHOOK
- name: Archive documentation files πŸ“
if: steps.check.outputs.update == 'true'
uses: actions/upload-artifact@v3
with:
name: ${{ steps.check.outputs.msg }}
path: scripts/tmp
- name: Deploy site πŸš€
if: steps.check.outputs.update == 'true'
env:
VERCEL_DEPLOY_HOOK: ${{ secrets.VERCEL_DEPLOY_HOOK }}
run: |
# sleep for a bit for GitHub's cache
sleep 10s
curl -X POST $VERCEL_DEPLOY_HOOK