-
Notifications
You must be signed in to change notification settings - Fork 1
102 lines (87 loc) · 2.85 KB
/
cd.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
name: CD
on:
pull_request:
types: [closed]
branches:
- wrap-0.1
jobs:
interface:
if: |
startsWith(github.event.pull_request.title, '[CD]') != true &&
github.event.pull_request.user.login != 'github-actions'
runs-on: ubuntu-latest
timeout-minutes: 60
defaults:
run:
working-directory: ./interface
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Read .nvmrc
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
id: nvm
- name: Setup Node.js
uses: actions/setup-node@master
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'
- name: Install dependencies
run: yarn install --nonInteractive --frozen-lockfile --prefer-offline
- name: Build
run: yarn build
- name: Deploy
run: yarn deploy
- name: PR New URI
uses: peter-evans/create-pull-request@v3
with:
branch: interface-cd-pr-${{github.event.number}}
commit-message: "[CD] interface"
title: "[CD] interface"
body: "Triggered by: https://github.com/${{github.repository}}/pull/${{github.event.number}}"
getImplementations:
if: |
startsWith(github.event.pull_request.title, '[CD]') != true &&
github.event.pull_request.user.login != 'github-actions'
runs-on: ubuntu-latest
outputs:
matrix: ${{ env.matrix }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- id: set-matrix
run: echo "matrix=$(./scripts/getImplementations.sh)" >> $GITHUB_ENV
implementations-cd:
if: |
startsWith(github.event.pull_request.title, '[CD]') != true &&
github.event.pull_request.user.login != 'github-actions'
runs-on: ubuntu-latest
needs:
- interface
- getImplementations
strategy:
matrix: ${{fromJSON(needs.getImplementations.outputs.matrix)}}
defaults:
run:
working-directory: ./implementations/${{ matrix.package }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Read .nvmrc
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
id: nvm
- name: Setup Node.js
uses: actions/setup-node@master
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'
- name: Install dependencies
run: yarn install --nonInteractive --frozen-lockfile --prefer-offline
- name: Build
run: yarn build
- name: Deploy
run: yarn deploy
- name: PR New URI
uses: peter-evans/create-pull-request@v3
with:
branch: ${{ matrix.package }}-cd-pr-${{github.event.number}}
commit-message: "[CD] ${{ matrix.package }}"
title: "[CD] ${{ matrix.package }}"
body: "Triggered by: https://github.com/${{github.repository}}/pull/${{github.event.number}}"