mirror of
https://github.com/msfjarvis/msfjarvis.dev.git
synced 2024-06-03 04:18:56 +05:30
87 lines
2.6 KiB
YAML
87 lines
2.6 KiB
YAML
name: Deploy to Cloudflare Workers Sites
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
inputs:
|
|
environment:
|
|
description: "Environment to deploy built site to"
|
|
required: true
|
|
type: "string"
|
|
|
|
jobs:
|
|
deploy-main:
|
|
if: "contains(github.event.head_commit.message, '[deploy]') || github.event.inputs.environment == '[deploy]'"
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout source
|
|
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
|
|
|
|
- name: Setup Latest Version of Hugo
|
|
uses: peaceiris/actions-hugo@c03b5dbed22245418539b65eb9a3b1d5fdd9a0a6 # tag=v2
|
|
with:
|
|
hugo-version: '0.104.1'
|
|
extended: true
|
|
|
|
- uses: actions/setup-go@268d8c0ca0432bb2cf416faae41297df9d262d7f # tag=v3
|
|
with:
|
|
go-version-file: 'go.mod'
|
|
|
|
- name: Build Hugo Site
|
|
shell: bash
|
|
run: |
|
|
yarn install
|
|
hugo --minify --gc
|
|
|
|
- name: Publish to Cloudflare Workers Sites
|
|
uses: cloudflare/wrangler-action@2.0.0
|
|
with:
|
|
apiToken: ${{ secrets.CF_API_TOKEN }}
|
|
accountId: ${{ secrets.CF_ACCOUNT_ID }}
|
|
command: publish --env production
|
|
env:
|
|
CF_ZONE_ID: ${{ secrets.CF_ZONE_ID }}
|
|
|
|
- name: Notify search engines of sitemap updates
|
|
shell: bash
|
|
run: |
|
|
SITEMAP_URL="https://msfjarvis.dev/sitemap.xml"
|
|
curl "https://google.com/ping?sitemap=${SITEMAP_URL}"
|
|
curl "https://www.bing.com/ping?sitemap=${SITEMAP_URL}"
|
|
|
|
deploy-staging:
|
|
if: "contains(github.event.head_commit.message, '[staging]') || github.event.inputs.environment == '[staging]'"
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout source
|
|
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
|
|
|
|
- name: Setup Latest Version of Hugo
|
|
uses: peaceiris/actions-hugo@c03b5dbed22245418539b65eb9a3b1d5fdd9a0a6 # tag=v2
|
|
with:
|
|
hugo-version: '0.104.1'
|
|
extended: true
|
|
|
|
- uses: actions/setup-go@268d8c0ca0432bb2cf416faae41297df9d262d7f # tag=v3
|
|
with:
|
|
go-version-file: 'go.mod'
|
|
|
|
- name: Build Hugo Site
|
|
shell: bash
|
|
run: |
|
|
yarn install
|
|
hugo --minify --gc -D --baseUrl 'https://drafts.msfjarvis.dev/'
|
|
|
|
- name: Publish to Cloudflare Workers Sites
|
|
uses: cloudflare/wrangler-action@2.0.0
|
|
with:
|
|
apiToken: ${{ secrets.CF_API_TOKEN }}
|
|
accountId: ${{ secrets.CF_ACCOUNT_ID }}
|
|
command: publish
|
|
env:
|
|
CF_ZONE_ID: ${{ secrets.CF_ZONE_ID }}
|