-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (61 loc) · 2.01 KB
/
experiments-deploy.yml
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
name: Deploy Experiment app
on:
push:
branches:
- main
paths:
- "packages/experiments/**"
- ".github/workflows/experiments-deploy.yml"
pull_request:
branches:
- main
paths:
- "packages/experiments/**"
- ".github/workflows/experiments-deploy.yml"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
experiments-deploy-pages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
cache: "npm"
- name: Install dependencies
shell: bash
run: npm install
- run: npm run ex:build
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
GA_TRACKING_ID: "G-PPE5XD2VKV"
- name: Deploy production build
uses: cloudflare/wrangler-action@2.0.0
with:
apiToken: ${{ secrets.CLOUDFLARE_WORKERS_DEPLOY_API_TOKEN }}
workingDirectory: "packages/experiments/"
command: pages publish ".svelte-kit/cloudflare" --branch=${{ github.head_ref }} --project-name=hot-or-not-experiments --commit-dirty=true
env:
CLOUDFLARE_ACCOUNT_ID: "a209c523d2d9646cc56227dbe6ce3ede"
- name: Get preview deployment URL
id: preview-url
working-directory: "packages/experiments/"
run: |
echo "url=$(grep -o 'http[s]*://[^\\]*' url.txt)" >> $GITHUB_OUTPUT
comment-on-pr:
name: Add a comment with the deployment link on the PR
if: github.actor != 'dependabot[bot]'
needs: ["experiments-deploy-pages"]
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Experiments preview build: ${{ needs.experiments-deploy-pages.outputs.previewUrl }}'
})