-
Notifications
You must be signed in to change notification settings - Fork 50
78 lines (73 loc) · 2.44 KB
/
main.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
name: Build, Test, Lint
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build-test-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 9
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Lint
run: pnpm run lint
- name: Build
run: pnpm run build
env:
NEXT_PUBLIC_SUPABASE_URL: ${{ vars.NEXT_PUBLIC_SUPABASE_URL }}
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY }}
- name: Test
run: xvfb-run -a pnpm run test
- name: If release, Publish to NPM
if: github.ref == 'refs/heads/main' && startsWith(github.event.head_commit.message, 'Prepare for v')
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
for package in $(pnpm list --json --only-projects -r | jq -c '.[]'); do
name=$(echo $package | jq -r '.name')
path=$(echo $package | jq -r '.path')
cd $path
is_private=$(echo $package | jq '.private')
if [[ "$is_private" == "true" ]]; then
echo "Skipping private package: $name"
cd $root
continue
fi
if [[ "$name" == "website" || "$name" == "flyde-vscode" ]]; then
echo "Skipping package: $name"
cd $root
continue
fi
echo "Publishing $name"
pnpm publish --access public --force --no-git-checks
echo "Published $name\n\n"
cd $root
done