-
Notifications
You must be signed in to change notification settings - Fork 4
100 lines (83 loc) · 2.33 KB
/
ci.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: CI
on:
push:
branches:
- main
tags:
- '**'
pull_request: {}
env:
COLUMNS: 150
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm install
- uses: pre-commit/[email protected]
with:
extra_args: --all-files --verbose
env:
SKIP: no-commit-to-branch
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm install
- uses: cloudflare/wrangler-action@v3
name: Test deploy
with:
command: deploy --dry-run
workingDirectory: src/backend
check:
if: always()
needs: [lint, build]
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
deploy-preview:
if: 'success() && github.event.pull_request.head.repo.full_name == github.repository'
runs-on: ubuntu-latest
needs: [check]
environment:
name: deploy-preview
url: ${{ steps.get_preview_url.outputs.preview_url }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm install
- uses: cloudflare/wrangler-action@v3
name: Deploy pydantic-run-preview
id: deploy
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
environment: previews
command: deploy --var GITHUB_SHA:${{ github.sha }}
workingDirectory: src/backend
- name: get preview URL
id: get_preview_url
run: python .github/get_preview_url.py >> $GITHUB_OUTPUT
env:
DEPLOY_OUTPUT: ${{ steps.deploy.outputs.command-output }}
deploy:
if: "success() && github.ref == 'refs/heads/main'"
runs-on: ubuntu-latest
needs: [check]
environment:
name: deploy-prod
url: https://pydantic.run
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm install
- uses: cloudflare/wrangler-action@v3
name: Deploy pydantic-run
with:
apiToken: ${{ secrets.cloudflare_api_token }}
command: deploy --var GITHUB_SHA:${{ github.sha }}
workingDirectory: src/backend