-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (60 loc) · 2.07 KB
/
Copy pathdeploy-website.yml
File metadata and controls
71 lines (60 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Deploy Terraphim.ai Website
on:
push:
branches: [main]
paths: ['website/**']
pull_request:
branches: [main]
paths: ['website/**']
workflow_dispatch:
jobs:
deploy:
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup 1Password CLI
uses: 1password/setup@v1
with:
op-service-account-token: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
- name: Install Zola
run: |
curl -L https://github.com/getzola/zola/releases/download/v0.22.1/zola-v0.22.1-x86_64-unknown-linux-gnu.tar.gz | tar xz
sudo mv zola /usr/local/bin
zola --version
- name: Install Wrangler
run: npm install -g wrangler
- name: Load 1Password secrets
run: |
echo "CLOUDFLARE_API_TOKEN=$(op read 'op://Terraphim/Terraphim AI Cloudflare Workers API Token/credential')" >> $GITHUB_ENV
echo "CLOUDFLARE_ACCOUNT_ID=$(op read 'op://Terraphim/Terraphim AI Cloudflare Account ID/Account')" >> $GITHUB_ENV
- name: Authenticate with Cloudflare
run: |
echo $CLOUDFLARE_API_TOKEN | wrangler auth login
- name: Build website
run: |
cd website
zola build
- name: Deploy to Cloudflare Pages
run: |
cd website
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
echo "Deploying to production..."
wrangler pages deploy public --project-name=terraphim-ai --branch=main
else
echo "Deploying to preview..."
wrangler pages deploy public --project-name=terraphim-ai --branch=preview
fi
- name: Create deployment
uses: chrnorm/deployment-action@v2
if: github.ref == 'refs/heads/main'
with:
token: '${{ github.token }}'
environment: production
ref: ${{ github.sha }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}