mirror of
https://github.com/msfjarvis/msfjarvis.dev.git
synced 2024-06-03 04:18:56 +05:30
80 lines
2.2 KiB
YAML
80 lines
2.2 KiB
YAML
name: Deploy to Cloudflare Workers Sites
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
deploy-main:
|
|
if: "contains(github.event.head_commit.message, '[deploy]')"
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout source
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Setup Latest Version of Hugo
|
|
uses: peaceiris/actions-hugo@v2
|
|
with:
|
|
hugo-version: '0.91.0'
|
|
extended: true
|
|
|
|
- uses: actions/setup-go@v2
|
|
with:
|
|
go-version: '1.17.5'
|
|
|
|
- name: Build Hugo Site
|
|
shell: bash
|
|
run: |
|
|
hugo --minify --gc
|
|
|
|
- name: Publish to Cloudflare Workers Sites
|
|
run: |
|
|
echo "prefix = \"${HOME}\"" > ~/.npmrc
|
|
npm install -g @cloudflare/wrangler
|
|
mkdir -p ~/.wrangler/config/
|
|
echo "api_token=\"${CF_API_TOKEN}\"" > ~/.wrangler/config/default.toml
|
|
~/bin/wrangler publish --env production
|
|
env:
|
|
SECRETS_ENC_KEY: ${{ secrets.SECRETS_ENC_KEY }}
|
|
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
|
|
CF_ZONE_ID: ${{ secrets.CF_ZONE_ID }}
|
|
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
|
|
|
|
deploy-staging:
|
|
if: "contains(github.event.head_commit.message, '[staging]')"
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout source
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Setup Latest Version of Hugo
|
|
uses: peaceiris/actions-hugo@v2
|
|
with:
|
|
hugo-version: '0.91.0'
|
|
extended: true
|
|
|
|
- uses: actions/setup-go@v2
|
|
with:
|
|
go-version: '1.17.5'
|
|
|
|
- name: Build Hugo Site
|
|
shell: bash
|
|
run: |
|
|
hugo --minify --gc -D --baseUrl 'https://drafts.msfjarvis.dev/'
|
|
|
|
- name: Publish to Cloudflare Workers Sites
|
|
run: |
|
|
echo "prefix = \"${HOME}\"" > ~/.npmrc
|
|
npm install -g @cloudflare/wrangler
|
|
mkdir -p ~/.wrangler/config/
|
|
echo "api_token=\"${CF_API_TOKEN}\"" > ~/.wrangler/config/default.toml
|
|
~/bin/wrangler publish
|
|
env:
|
|
SECRETS_ENC_KEY: ${{ secrets.SECRETS_ENC_KEY }}
|
|
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
|
|
CF_ZONE_ID: ${{ secrets.CF_ZONE_ID }}
|
|
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
|