Updated Day 1869 #792
This file contains hidden or 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: Build and Deploy WTF Just Happened Today? Jekyll Site | |
| on: | |
| push: | |
| branches: | |
| - master | |
| workflow_dispatch: # allow manual triggering | |
| jobs: | |
| build-deploy: | |
| runs-on: ubuntu-latest | |
| env: | |
| JEKYLL_ENV: production | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Ruby with caching | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: 3.3.5 | |
| bundler-cache: true | |
| - name: Build Jekyll site | |
| run: bundle exec jekyll build | |
| - name: Compress search index | |
| run: | | |
| # Keep original for Cloudflare Brotli, create gzip fallback | |
| gzip -9 -k _site/search-index.json | |
| - name: Deploy to S3 | |
| uses: reggionick/s3-deploy@v4 | |
| with: | |
| folder: _site | |
| bucket: whatthefuckjusthappenedtoday.com | |
| bucket-region: us-east-1 | |
| delete-removed: false | |
| no-cache: true | |
| private: false | |
| env: | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| - name: Purge Cloudflare cache | |
| run: | | |
| curl -X DELETE "https://api.cloudflare.com/client/v4/zones/2fa02b93146397fbf2001d812ab8b31f/purge_cache" \ | |
| -H "X-Auth-Email: ${{ secrets.CLOUD_FLARE_EMAIL }}" \ | |
| -H "X-Auth-Key: ${{ secrets.CLOUD_FLARE_API_KEY }}" \ | |
| -H "Content-Type: application/json" \ | |
| --data '{"purge_everything":true}' | |
| - name: Ping search engines and feeds | |
| run: | | |
| # Run all pings in parallel | |
| BASE=https://whatthefuckjusthappenedtoday.com | |
| HUB=https://pubsubhubbub.appspot.com/ | |
| AUTH_DATE=$(date +%s) | |
| AUTH_HASH=$(echo -n "${{ secrets.PODCAST_INDEX_API_KEY }}${{ secrets.PODCAST_INDEX_API_SECRET }}${AUTH_DATE}" | sha1sum | awk '{print $1}') | |
| # Bing | |
| curl -s "http://www.bing.com/ping?sitemap=$BASE/sitemap.xml" & | |
| # WebSub hub | |
| curl -s -X POST "$HUB" -d "hub.mode=publish" \ | |
| -d "hub.url=$BASE/rss.xml" \ | |
| -d "hub.url=$BASE/atom.xml" \ | |
| -d "hub.url=$BASE/feed.json" \ | |
| -d "hub.url=$BASE/podcasts/index.xml" & | |
| # Podcast Index | |
| curl -s -X POST "https://api.podcastindex.org/api/1.0/hub/pubnotify" \ | |
| -H "Content-Type: application/x-www-form-urlencoded" \ | |
| -H "X-Auth-Key: ${{ secrets.PODCAST_INDEX_API_KEY }}" \ | |
| -H "X-Auth-Date: ${AUTH_DATE}" \ | |
| -H "Authorization: ${AUTH_HASH}" \ | |
| -d "url=$BASE/podcasts/index.xml" & | |
| # Wait for all background jobs | |
| wait | |
| - name: Notify Slack | |
| if: always() | |
| uses: rtCamp/action-slack-notify@v2 | |
| env: | |
| SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| SLACK_USERNAME: WTFJHT Bot | |
| SLACK_ICON_EMOJI: ':newspaper:' | |
| SLACK_TITLE: GitHub Actions Build | |
| SLACK_COLOR: ${{ job.status == 'success' && '#36a64f' || '#ff0000' }} | |
| SLACK_MESSAGE: "${{ github.workflow }} #${{ github.run_number }} by ${{ github.actor }} - ${{ job.status }}" |