Skip to content

Deploy GitHub pages with traffic stats #556

Deploy GitHub pages with traffic stats

Deploy GitHub pages with traffic stats #556

name: Deploy GitHub pages with traffic stats
on:
schedule:
- cron: "0 3 * * *"
jobs:
build-n-publish:
runs-on: ubuntu-latest
env:
BOT_NAME: 'github-actions[bot]'
BOT_EMAIL: '41898282+github-actions[bot]@users.noreply.github.com'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Update repository topics
shell: bash
env:
URL: https://api.github.com/repos/${{ github.repository }}/topics
TOPICS: '{"names":["github","docker","github-pages","traffic","static-site","python3","stats","github-actions","github-stats-pages"]'
AUTH: "Authorization: token ${{ secrets.GH_TOKEN }}"
run: |
curl -X PUT "$URL" -d "$TOPICS" \
-H "Accept: application/vnd.github.mercy-preview+json" -H "$AUTH"
- name: Build GitHub stats pages
uses: astrochun/github-stats-pages@latest
with:
username: ${{ github.repository_owner }}
token: ${{ secrets.GH_TOKEN }}
include-repos: "osprey"
- name: List contents
run: |
ls -ltRh
- name: Upload data to main branch
uses: EndBug/[email protected]
with:
add: 'data'
branch: main
message: "Update data: ${{ steps.date.outputs.date }}"
author_name: ${{ env.BOT_NAME }}
author_email: ${{ env.BOT_EMAIL }}
- name: Upload static files to gh-pages
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.GH_TOKEN }}
publish_dir: ./public
keep_files: false
user_name: ${{ env.BOT_NAME }}
user_email: ${{ env.BOT_EMAIL }}
publish_branch: gh-pages
commit_message: "Update static pages: ${{ steps.date.outputs.date }}"