-
Notifications
You must be signed in to change notification settings - Fork 2
126 lines (111 loc) · 4.22 KB
/
build.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: Node.js CI
on:
push:
branches:
- main
- develop
pull_request:
branches:
- develop
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "YARN_CACHE_DIR=$(yarn cache dir)" >> $GITHUB_ENV
- uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ env.YARN_CACHE_DIR }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn
- run: yarn lint
- run: yarn build
- run: yarn test
env:
INCREMENTP_VERIFICATION_API_ENDPOINT: ${{ secrets.INCREMENTP_VERIFICATION_API_ENDPOINT }}
INCREMENTP_VERIFICATION_API_KEY: ${{ secrets.INCREMENTP_VERIFICATION_API_KEY }}
GEOLONIA_API_KEY: ${{ secrets.GEOLONIA_API_KEY }}
deploy:
runs-on: ubuntu-latest
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
permissions:
id-token: write
contents: read
needs: build
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' }}
steps:
- uses: actions/checkout@v3
with:
# Sentry requires the full history to report the commit hashes between releases.
fetch-depth: 0
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "YARN_CACHE_DIR=$(yarn cache dir)" >> $GITHUB_ENV
- uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ env.YARN_CACHE_DIR }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: ap-northeast-1
role-to-assume: arn:aws:iam::762706324393:role/github-actions-estate-id-deploy
- name: "Deploy to dev environment"
if: ${{ github.ref == 'refs/heads/develop' }}
run: yarn deploy:dev
env:
INCREMENTP_VERIFICATION_API_ENDPOINT: ${{ secrets.INCREMENTP_VERIFICATION_API_ENDPOINT }}
INCREMENTP_VERIFICATION_API_KEY: ${{ secrets.INCREMENTP_VERIFICATION_API_KEY }}
GEOLONIA_API_KEY: ${{ secrets.GEOLONIA_API_KEY }}
ACCESS_TOKEN_SALT: ${{ secrets.ACCESS_TOKEN_SALT }}
# v1のユーザープールを使う
AUTH0_CLIENT_ID_V1: ${{ secrets.AUTH0_CLIENT_ID_V1 }}
AUTH0_CLIENT_ID_DEV: ${{ secrets.AUTH0_CLIENT_ID_DEV }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
- name: "Deploy to v1 environment"
if: ${{ github.ref == 'refs/heads/main' }}
run: yarn deploy:v1
env:
INCREMENTP_VERIFICATION_API_ENDPOINT: ${{ secrets.INCREMENTP_VERIFICATION_API_ENDPOINT }}
INCREMENTP_VERIFICATION_API_KEY: ${{ secrets.INCREMENTP_VERIFICATION_API_KEY }}
GEOLONIA_API_KEY: ${{ secrets.GEOLONIA_API_KEY }}
ACCESS_TOKEN_SALT: ${{ secrets.ACCESS_TOKEN_SALT }}
AUTH0_CLIENT_ID_V1: ${{ secrets.AUTH0_CLIENT_ID_V1 }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
- name: Create build for Sentry release
run: yarn build --outDir dist
- name: Create Sentry release (dev)
if: ${{ github.ref == 'refs/heads/develop' }}
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
environment: dev
sourcemaps: ./dist/
version: ${{ github.sha }}
- name: Create Sentry release (v1)
if: ${{ github.ref == 'refs/heads/main' }}
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
environment: v1
sourcemaps: ./dist/
version: ${{ github.sha }}