-
-
Notifications
You must be signed in to change notification settings - Fork 256
74 lines (69 loc) · 2.37 KB
/
deploy.yml
File metadata and controls
74 lines (69 loc) · 2.37 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
72
73
74
name: Deploy to Cloudflare Pages
on:
push:
branches:
- master
workflow_dispatch:
inputs:
environment:
description: "Choose an environment to deploy to: <preview|production>"
required: true
default: "preview"
pull_request:
jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false }}
permissions:
contents: read
deployments: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Setup yarn
uses: actions/setup-node@v3
with:
cache: "yarn"
node-version: "24"
- name: Install dependencies
run: yarn install
- name: Sync playground bundles
run: yarn build:sync-bundles
- name: Set VITE_DEPLOYMENT_URL
shell: bash
run: |
RAW_BRANCH="${{ github.head_ref || github.ref_name }}"
if [[ "$RAW_BRANCH" == "master" ]]; then
echo "VITE_DEPLOYMENT_URL=" >> "$GITHUB_ENV"
else
SAFE_BRANCH="${RAW_BRANCH//\//-}"
SAFE_BRANCH=$(echo "$SAFE_BRANCH" | tr '[:upper:]' '[:lower:]')
echo "SAFE_BRANCH=$SAFE_BRANCH" >> "$GITHUB_ENV"
echo "VITE_DEPLOYMENT_URL=https://${SAFE_BRANCH}.rescript-lang.pages.dev" >> "$GITHUB_ENV"
fi
- name: Build
run: yarn build
env:
VITE_DEPLOYMENT_URL: ${{ env.VITE_DEPLOYMENT_URL }}
- name: Deploy
id: deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy out --project-name=rescript-lang-org --branch=${{ env.SAFE_BRANCH }}
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
wranglerVersion: 4.63.0
env:
FORCE_COLOR: 0
- name: Comment PR with deployment link
uses: marocchino/sticky-pull-request-comment@v2
with:
recreate: true
header: deploymemt
message: |
## Cloudflare deployment
Deployement ID: ${{ steps.deploy.outputs.pages-deployment-id }}
Deployment Environment: ${{ steps.deploy.outputs.pages-environment }}
${{ steps.deploy.outputs.command-output }}