-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (103 loc) · 3.23 KB
/
prd-deploy.yaml
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
101
102
103
104
105
106
name: Build App for Production
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
id-token: write
pages: write
packages: write
env:
PNPM_VERSION: 9.15.4
NODE_VERSION: 20.9.0
jobs:
filter:
runs-on: ubuntu-latest
outputs:
frontend: ${{ steps.filter.outputs.frontend }}
spec: ${{ steps.filter.outputs.spec }}
example: ${{ steps.filter.outputs.example }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
frontend:
- "frontend/**"
- ".github/workflows/prd-deploy.yaml"
spec:
- "spec/**"
- ".github/workflows/prd-deploy.yaml"
example:
- "example/**"
- ".github/workflows/prd-deploy.yaml"
prd-build-backend:
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/docker-build
with:
gh-token: ${{ secrets.GITHUB_TOKEN }}
github-actor: ${{ github.actor }}
tags: ghcr.io/${{ github.repository }}-backend:1.0.${{ github.run_number }}
path: "."
cache-registry: ghcr.io/${{ github.repository }}-backend:buildcache
prd-build-frontend:
runs-on: ubuntu-latest
environment: production
needs: filter
if: needs.filter.outputs.frontend == 'true'
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/docker-build
with:
gh-token: ${{ secrets.GITHUB_TOKEN }}
github-actor: ${{ github.actor }}
tags: ghcr.io/${{ github.repository }}-frontend:1.0.${{ github.run_number }}
path: "./frontend"
build-args: |
NEXT_PUBLIC_API_URL=https://auth.piny940.com/api/v1
cache-registry: ghcr.io/${{ github.repository }}-frontend:buildcache
prd-build-example:
runs-on: ubuntu-latest
environment: production
needs: filter
if: needs.filter.outputs.example == 'true'
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/docker-build
with:
gh-token: ${{ secrets.GITHUB_TOKEN }}
github-actor: ${{ github.actor }}
tags: ghcr.io/${{ github.repository }}-example:1.0.${{ github.run_number }}
path: "./example"
build-args: |
NEXT_PUBLIC_API_URL=https://auth.piny940.com/api/v1
cache-registry: ghcr.io/${{ github.repository }}-example:buildcache
build-doc:
runs-on: ubuntu-latest
needs: filter
if: needs.filter.outputs.spec == 'true'
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION}}
package_json_file: "spec/package.json"
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"
cache-dependency-path: "spec/package.json"
- name: Build doc
run: cd spec && pnpm run export
- uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: |
pages deploy --project-name=auth-doc spec/out