-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (58 loc) · 1.9 KB
/
shared_frontend.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
name: Shared Frontend
on:
workflow_dispatch:
push:
paths:
- "frontend/packages/shared/**"
- "!**/*.md"
# Setting 'branches' has the side effect that just pushing tags does not start workflows.
branches:
- '**'
env:
FRONTEND_DIR: ./frontend
GITHUB_REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy:
if: contains(github.event.head_commit.message, 'SHARED')
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.16.0]
steps:
- uses: actions/checkout@v3
- uses: szenius/[email protected]
with:
timezoneLinux: "Europe/Helsinki"
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v3
id: yarn-cache
with:
path: "**/node_modules"
key: ${{ runner.os }}-yarn-cache-${{ hashFiles('frontend/package.json') }}-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
working-directory: ${{ env.FRONTEND_DIR }}
run: |
yarn install --immutable
if: steps.yarn-cache.outputs.cache-hit != 'true'
- name: Run Linters
working-directory: ${{ env.FRONTEND_DIR }}
run: yarn shared:lint
- name: Format
working-directory: ${{ env.FRONTEND_DIR }}
run: yarn shared:format
- name: Run Jest Tests
working-directory: ${{ env.FRONTEND_DIR }}
run: yarn shared:test:jest
- name: Publish to GitHub Packages
if: |
github.ref == 'refs/heads/dev' || contains(github.event.head_commit.message, '[deploy]')
working-directory: ${{ env.FRONTEND_DIR }}/packages/shared
run: yarn npm publish
env:
YARN_NPM_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}