-
Notifications
You must be signed in to change notification settings - Fork 50
173 lines (160 loc) · 4.87 KB
/
client.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: CI for client
on:
pull_request:
branches:
- master
push:
branches:
- master
- dev
env:
NODE_VERSION: "18.14.0"
HAPPYPANDAX_TOKEN: ${{ secrets.HAPPYPANDAX_TOKEN }}
defaults:
run:
shell: bash
jobs:
test:
name: Test client
strategy:
matrix:
os:
- ubuntu-22.04
- windows-2022
- macos-11
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: "yarn"
cache-dependency-path: yarn.lock
- name: Setup yarn
run: |
corepack enable
corepack prepare yarn@stable --activate
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Cache yarn cache
uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --immutable
- name: Run tests
run: yarn run:client test
build:
name: Build client
# needs:
# - test
strategy:
matrix:
os:
- ubuntu-22.04
- windows-2022
- macos-11
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup yarn
run: |
corepack enable
corepack prepare yarn@stable --activate
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Cache yarn cache
uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --immutable
- name: Build
run: |
yarn run:client build:css
yarn run:client build
- name: Store build
uses: actions/upload-artifact@v3
with:
name: build
path: |
packages/client/.next
packages/client/public
package:
name: Package client
needs:
- build
strategy:
matrix:
os:
- ubuntu-22.04
- windows-2022
- macos-11
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Load build
uses: actions/download-artifact@v3
with:
name: build
path: packages/client
- name: Display structure of files
run: ls -R
working-directory: packages/client
- name: Install global dependencies
run: |
npm install -g rimraf cross-env nexe
yarn add nexe
- name: Install production dependencies
run: yarn plugin import workspace-tools && yarn workspaces focus --all --production && rm -rf "$(yarn cache clean)"
- name: Package
run: yarn run:client package
- name: Set release name
run: |
echo "HPX_VERSION=$(node -p "require('./packages/client/package.json').version")" >> $GITHUB_ENV
echo "RELEASE_NAME=happypandax_client-$(node -p "require('./packages/client/package.json').version")" >> $GITHUB_ENV
- name: Tag release
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git tag -a ${{ env.RELEASE_NAME }} -m "Release ${{ env.RELEASE_NAME }}" || true
git push --quiet --tags || true
- name: Archive release
run: |
cd packages/client/dist
if [ "${{ matrix.os }}" == "windows-2022" ]; then
7z a -tzip ${{ env.RELEASE_NAME }}-${{ matrix.os }}.zip ./*
else
tar -czf ../${{ env.RELEASE_NAME }}-${{ matrix.os }}.tar.gz *
fi
- name: Publish
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.HAPPYPANDAX_TOKEN }}
with:
file: "**/*.zip;**/*.tar.gz"
tag_name: client-v${{ env.HPX_VERSION }}
draft: true
overwrite: true
prerelease: true