-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (116 loc) · 4.4 KB
/
stg-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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: Build App for Staging
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
permissions:
contents: read
id-token: write
packages: write
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/stg-deploy.yaml"
spec:
- "spec/**"
- ".github/workflows/stg-deploy.yaml"
example:
- "example/**"
- ".github/workflows/stg-deploy.yaml"
stg-build-backend:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
environment: staging # 管理者の承認を必要とする
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:stg-${{ github.sha }}-${{ github.run_number }}
path: "."
cache-registry: ghcr.io/${{ github.repository }}-backend:buildcache
stg-build-backend-main:
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
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:stg-${{ github.sha }}-${{ github.run_number }}
path: "."
cache-registry: ghcr.io/${{ github.repository }}-backend:buildcache
stg-build-frontend:
runs-on: ubuntu-latest
needs: filter
if: github.event_name == 'pull_request' && needs.filter.outputs.frontend == 'true'
environment: staging # 管理者の承認を必要とする
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:stg-${{ github.sha }}-${{ github.run_number }}
path: "./frontend"
build-args: |
NEXT_PUBLIC_API_URL=https://stg-auth.piny940.com/api/v1
cache-registry: ghcr.io/${{ github.repository }}-frontend:buildcache
stg-build-frontend-main:
runs-on: ubuntu-latest
needs: filter
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && 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:stg-${{ github.sha }}-${{ github.run_number }}
path: "./frontend"
build-args: |
NEXT_PUBLIC_API_URL=https://stg-auth.piny940.com/api/v1
cache-registry: ghcr.io/${{ github.repository }}-frontend:buildcache
stg-build-example:
runs-on: ubuntu-latest
needs: filter
if: github.event_name == 'pull_request' && needs.filter.outputs.example == 'true'
environment: staging # 管理者の承認を必要とする
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:stg-${{ github.sha }}-${{ github.run_number }}
path: "./example"
cache-registry: ghcr.io/${{ github.repository }}-example:buildcache
stg-build-example-main:
runs-on: ubuntu-latest
needs: filter
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && 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:stg-${{ github.sha }}-${{ github.run_number }}
path: "./example"
cache-registry: ghcr.io/${{ github.repository }}-example:buildcache