Deploy GitHub Pages #16804
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: Deploy GitHub Pages | |
on: | |
push: | |
branches: ["main"] | |
workflow_dispatch: | |
schedule: | |
- cron: '04 * * * *' | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Pages | |
uses: actions/configure-pages@v2 | |
- name: Build | |
env: | |
DEV_TO_API_KEY: ${{ secrets.DEV_TO_API_KEY }} | |
COMMUNITY_CODENEWBIE_ORG_API_KEY: ${{ secrets.COMMUNITY_CODENEWBIE_ORG_API_KEY }} | |
run: | | |
python report.py --collect --host community.codenewbie.org --stats --html --limit 100 --sleep 1 | |
python report.py --collect --host dev.to --stats --html --limit 100 --sleep 1 | |
- name: Commit new page | |
run: | | |
set -x | |
GIT_STATUS=$(git status --porcelain) | |
echo $GIT_STATUS | |
git config user.name github-actions[bot] | |
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
git add data/ | |
if [ "$GIT_STATUS" != "" ]; then git commit -m "Automated Web page generation"; fi | |
if [ "$GIT_STATUS" != "" ]; then git push; fi | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
# Deployment job | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |