-
Notifications
You must be signed in to change notification settings - Fork 35
126 lines (111 loc) · 3.16 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
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: build
on:
push:
branches:
- master
tags: ['*']
pull_request:
branches:
- master
jobs:
build:
name: "ビルド・リント"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '22.x'
cache: 'npm'
- run: npm ci
- run: npm run lint
- run: npm run build
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist
- uses: actions/upload-pages-artifact@v3
if: github.ref == 'refs/heads/master'
with:
path: demo
deploy-pages:
name: "GitHub Pages へのデプロイ"
runs-on: ubuntu-latest
needs:
- build
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/deploy-pages@v4
id: deployment
test:
name: "テスト"
needs:
- build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [18.x, 20.x, 22.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- uses: actions/download-artifact@v4
with:
name: dist
path: dist
- run: npm ci
- run: npm test
# 結合テストはビルドされたものが必要
# また、Node.js 18.x では結合テストをスキップする
- name: 結合テスト
if: matrix.node-version != '18.x'
run: npm run test:integration
# アドレステストは時間かかるし、環境依存が無いので、matrixにいれる必要無い
test-addresses:
name: "詳細住所テスト"
needs:
- build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '22.x'
cache: 'npm'
- run: npm ci
- run: npm run build
- run: npm run test:addresses
publish:
name: 'npm 公開'
runs-on: ubuntu-latest
needs:
- test
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v4
with:
node-version: '22.x'
registry-url: 'https://registry.npmjs.org'
scope: '@geolonia'
cache: 'npm'
- run: npm ci
- run: npm run build
- run: npm publish --access=public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}