|
| 1 | +name: Build and Deploy WTF Just Happened Today? Jekyll Site |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + schedule: |
| 8 | + - cron: '0 9 * * *' # daily at 9 AM UTC (2 AM PT / 5 AM ET) |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +jobs: |
| 12 | + build-deploy: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + env: |
| 15 | + JEKYLL_ENV: production |
| 16 | + |
| 17 | + steps: |
| 18 | + - name: Checkout repository |
| 19 | + uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Set up Ruby |
| 22 | + uses: ruby/setup-ruby@v1 |
| 23 | + with: |
| 24 | + ruby-version: 3.3.5 |
| 25 | + bundler-cache: true |
| 26 | + |
| 27 | + - name: Install bundler and configure |
| 28 | + run: | |
| 29 | + gem install bundler -v 2.6.6 |
| 30 | + bundle config set path 'vendor/bundle' |
| 31 | + bundle config set force_ruby_platform true |
| 32 | + ruby -v |
| 33 | + bundler -v |
| 34 | + gem -v |
| 35 | + gem environment |
| 36 | +
|
| 37 | + - name: Install dependencies |
| 38 | + run: | |
| 39 | + bundle install --jobs=3 --retry=3 |
| 40 | + bundle clean --force |
| 41 | +
|
| 42 | + - name: Make scripts executable |
| 43 | + run: chmod +x ./script/* |
| 44 | + |
| 45 | + - name: Run cron build (Algolia) |
| 46 | + if: github.event_name == 'schedule' |
| 47 | + run: ./script/cibuildindex |
| 48 | + shell: bash |
| 49 | + |
| 50 | + - name: Run regular build |
| 51 | + if: github.event_name != 'schedule' |
| 52 | + run: ./script/cibuild |
| 53 | + shell: bash |
| 54 | + |
| 55 | + - name: Deploy to S3 |
| 56 | + uses: jakejarvis/s3-sync-action@master |
| 57 | + with: |
| 58 | + args: --acl public-read --follow-symlinks |
| 59 | + env: |
| 60 | + AWS_S3_BUCKET: whatthefuckjusthappenedtoday.com |
| 61 | + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 62 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 63 | + AWS_REGION: us-east-1 |
| 64 | + SOURCE_DIR: _site |
| 65 | + |
| 66 | + - name: Purge Cloudflare cache |
| 67 | + run: | |
| 68 | + curl -X DELETE "https://api.cloudflare.com/client/v4/zones/2fa02b93146397fbf2001d812ab8b31f/purge_cache" \ |
| 69 | + -H "X-Auth-Email: ${{ secrets.CLOUD_FLARE_EMAIL }}" \ |
| 70 | + -H "X-Auth-Key: ${{ secrets.CLOUD_FLARE_API_KEY }}" \ |
| 71 | + -H "Content-Type: application/json" \ |
| 72 | + --data '{"purge_everything":true}' |
| 73 | +
|
| 74 | + - name: Ping search engines |
| 75 | + run: | |
| 76 | + curl https://www.google.com/webmasters/tools/ping?sitemap=https://whatthefuckjusthappenedtoday.com/sitemap.xml |
| 77 | + curl http://www.bing.com/ping?sitemap=https://whatthefuckjusthappenedtoday.com/sitemap.xml |
0 commit comments