-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Can manually deploy site or automatically deploy on push to main branch
- Loading branch information
1 parent
92c3452
commit c89e0e0
Showing
4 changed files
with
85 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: "Deploy Webpage to Cloudflare Pages" | ||
on: | ||
workflow_call: | ||
inputs: | ||
environment: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "18" | ||
cache: "npm" | ||
|
||
- name: Install Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
cache: "pip" | ||
|
||
- name: Install dependencies | ||
run: | | ||
npm install | ||
pip install -r project/requirements.txt | ||
- name: Create .env file | ||
run: | | ||
cat <<EOF > .env | ||
WEBSITE=${{ vars.CLOUDFLARE_PAGE_URL }} | ||
GOOGLE_SEARCHCONSOLE_AUTH=${{ secrets.GOOGLE_SEARCHCONSOLE_AUTH }} | ||
BING_WEBMASTER_AUTH=${{ secrets.BING_WEBMASTER_AUTH }} | ||
EOF | ||
- name: Build static files | ||
run: python3 project/make.py | ||
|
||
- name: Deploy to Cloudflare Pages | ||
uses: cloudflare/wrangler-action@v3 | ||
with: | ||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | ||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | ||
workingDirectory: "project/output" | ||
command: pages deploy --project-name=${{inputs.environment}} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: "Manual build" | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
environment: | ||
description: "Choose an environment to deploy to:" | ||
type: choice | ||
options: | ||
- "prod" | ||
- "staging" | ||
- "dev" | ||
default: "dev" | ||
|
||
jobs: | ||
deploy-page: | ||
name: Deploy page | ||
uses: ./.github/workflows/deploy-page.yaml | ||
secrets: inherit | ||
with: | ||
environment: ${{ github.event.inputs.environment }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: "Deploy on push" | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
deploy-page: | ||
name: Deploy page | ||
uses: ./.github/workflows/deploy-page.yaml | ||
secrets: inherit | ||
with: | ||
environment: "prod" |
This file contains 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