-
Notifications
You must be signed in to change notification settings - Fork 1
125 lines (125 loc) · 4.43 KB
/
main.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
name: CI
on:
push:
branches: [ main ]
paths-ignore:
- '.husky'
tags-ignore:
- '*'
pull_request:
branches: [ main ]
paths-ignore:
- '.husky'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build:
timeout-minutes: 10
if: "github.event_name == 'pull_request' || !contains(github.event.head_commit.message, 'skip ci')"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
node: ['18.x']
os: [ubuntu-latest]
include:
- os: ubuntu-latest
osname: linux
name: Node v${{ matrix.node }} on ${{ matrix.os }} (${{ matrix.osname }})
env:
GIHUB_ACTIONS_OS_NAME: ${{ matrix.osname }}
steps:
- run: echo 'GIHUB_ACTIONS_OS_NAME:' ${{ env.GIHUB_ACTIONS_OS_NAME }}
- run: 'echo "GITHUB_RUN_NUMBER: ${{ github.run_number }}"'
- run: 'echo "GITHUB_RUN_ID: ${{ github.run_id }}"'
- run: 'echo "GITHUB_SHA: ${{ github.sha }}"'
- name: Checkout
uses: actions/checkout@v2
with:
ref: main
- name: Git config global dump (post)
run: 'git config --global --list || echo NO_GIT_GLOBAL_CONFIG || true'
shell: bash
- name: Git config local dump (post)
run: 'git config --list || echo NO_GIT_GLOBAL_CONFIG || true'
shell: bash
- name: Install asdf
uses: asdf-vm/actions/setup@v1
- name: Cache asdf
id: asdf-cache
uses: actions/cache@v2
with:
path: ~/.asdf
key: asdf-${{ hashFiles('.tool-versions') }}
- name: Install asdf tools (Node and PNPM)
if: steps.asdf-cache.outputs.cache-hit != 'true'
uses: asdf-vm/actions/install@v1
#- name: Node v${{ matrix.node }}
# uses: actions/setup-node@v2
# with:
# node-version: ${{ matrix.node }}
## cache: pnpm
## cache-dependency-path: '**/pnpm-lock.yaml'
##- run: npm --global install npm@^8
##- run: npm --global install pnpm@^7
- name: PNPM cache
uses: actions/cache@v2
env:
cache-name: cache-pnpm-modules
with:
path: ~/.local/share/pnpm/store #~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- name: ENV NodeJS
run: |
echo node `node --version`;
echo npm `npm --version`;
echo pnpm `pnpm --version`
- name: PNPM install
run: pnpm install --frozen-lockfile
#uses: pnpm/action-setup@v2
#with:
# version: 7.1.3
# run_install: |
# - recursive: false
# args: [--frozen-lockfile]
## - args: [--global, typescript]
- name: ENV
run: |
echo cwd: `pwd`;
echo branch `git branch --show-current`;
echo node `node --version`;
echo npm `npm --version`;
echo pnpm `pnpm --version`
- run: git --no-pager diff
- name: PR action (just lint)
if: ${{ github.event_name == 'pull_request' }}
# Note that 'lint:eslint' invokes 'typescript' (necessary precondition for import resolver), so strictly-speaking there is no need for `pnpm typescript` here, but Turbo will skip/not repeat, so no time wasted :)
run: pnpm typescript --no-cache && pnpm lint && pnpm test
- name: non-PR action (lint and build)
if: ${{ github.event_name != 'pull_request' }}
# Note that 'lint:eslint' invokes 'typescript' (necessary precondition for import resolver), as well as 'build-github', so strictly-speaking there is no need for `pnpm typescript` here, but Turbo will skip/not repeat, so no time wasted :)
run: pnpm typescript --no-cache && pnpm lint && pnpm test && pnpm build-github && ls -R packages/wmr1/dist
- name: Checkout GH-PAGES
if: ${{ github.event_name != 'pull_request' }}
uses: actions/checkout@v2
with:
ref: gh-pages
path: gh-pages
- name: Copy dist to GH-PAGES
run: |
cp gh-pages/.gitignore packages/wmr1/dist/
rm -rf gh-pages/*
cd gh-pages
ls -als
cp -r ../packages/wmr1/dist/* ./
cp ../packages/preact-things/dist/esm/observant/core/index.js ./observant.esm.js
cp ../packages/preact-things/perf-online.html ./
touch .nojekyll
ls -als
git config user.name "Daniel Weck"
git config user.email [email protected]
git add .
git commit -m "chore(dist): automated GitHub Actions CI dist update" || echo "ok"
git push