Skip to content

Commit 7f27160

Browse files
authoredJun 23, 2024··
chore: simplify CI and only deploy docs site when packages publish (#95)
* add pm field and simplify CI * only deploy docs site when packages have been published
1 parent d39edac commit 7f27160

File tree

6 files changed

+42
-162
lines changed

6 files changed

+42
-162
lines changed
 

‎.github/workflows/ci.yml

+11-66
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,11 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v4
19-
20-
- uses: pnpm/action-setup@v3
21-
with:
22-
version: 8
23-
19+
- uses: pnpm/action-setup@v4
2420
- uses: actions/setup-node@v4
2521
with:
26-
node-version: 18
27-
28-
# PNPM Store cache setup
29-
- name: Get pnpm store directory
30-
id: pnpm-cache
31-
run: |
32-
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
33-
- name: Setup pnpm cache
34-
uses: actions/cache@v4
35-
with:
36-
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
37-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
38-
restore-keys: |
39-
${{ runner.os }}-pnpm-store-
22+
node-version: 20
23+
cache: pnpm
4024

4125
- name: Install dependencies
4226
run: pnpm install
@@ -55,30 +39,11 @@ jobs:
5539
name: Test
5640
steps:
5741
- uses: actions/checkout@v4
58-
59-
- name: Install Node.JS
60-
uses: actions/setup-node@v4
61-
with:
62-
node-version: 18
63-
64-
- uses: pnpm/action-setup@v3
65-
name: Install pnpm
66-
id: pnpm-install
67-
with:
68-
version: 8
69-
70-
# PNPM Store cache setup
71-
- name: Get pnpm store directory
72-
id: pnpm-cache
73-
run: |
74-
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
75-
- name: Setup pnpm cache
76-
uses: actions/cache@v4
42+
- uses: pnpm/action-setup@v4
43+
- uses: actions/setup-node@v4
7744
with:
78-
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
79-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
80-
restore-keys: |
81-
${{ runner.os }}-pnpm-store-
45+
node-version: 20
46+
cache: pnpm
8247

8348
- name: Install dependencies
8449
run: pnpm install
@@ -90,31 +55,11 @@ jobs:
9055
name: Lint
9156
steps:
9257
- uses: actions/checkout@v4
93-
94-
- name: Install Node.JS
95-
uses: actions/setup-node@v4
96-
with:
97-
node-version: 18
98-
99-
- uses: pnpm/action-setup@v3
100-
name: Install pnpm
101-
id: pnpm-install
102-
with:
103-
version: 8
104-
105-
# PNPM Store cache setup
106-
- name: Get pnpm store directory
107-
id: pnpm-cache
108-
run: |
109-
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
110-
111-
- name: Setup pnpm cache
112-
uses: actions/cache@v4
58+
- uses: pnpm/action-setup@v4
59+
- uses: actions/setup-node@v4
11360
with:
114-
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
115-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
116-
restore-keys: |
117-
${{ runner.os }}-pnpm-store-
61+
node-version: 20
62+
cache: pnpm
11863

11964
- name: Install dependencies
12065
run: pnpm install

‎.github/workflows/docs-preview.yml

+4-16
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,13 @@ jobs:
3838
with:
3939
ref: ${{ github.event.pull_request.head.ref }}
4040
repository: ${{ github.event.pull_request.head.repo.full_name }}
41-
- uses: pnpm/action-setup@v3
42-
with:
43-
version: 8
41+
42+
- uses: pnpm/action-setup@v4
43+
4444
- uses: actions/setup-node@v4
4545
with:
4646
node-version: 20
47-
48-
# PNPM Store cache setup
49-
- name: Get pnpm store directory
50-
id: pnpm-cache
51-
run: |
52-
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
53-
- name: Setup pnpm cache
54-
uses: actions/cache@v4
55-
with:
56-
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
57-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
58-
restore-keys: |
59-
${{ runner.os }}-pnpm-store-
47+
cache: pnpm
6048

6149
- name: Install dependencies
6250
run: pnpm install

‎.github/workflows/docs-production.yml

-56
This file was deleted.

‎.github/workflows/release.yml

+24-23
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,20 @@ jobs:
1515
name: Release
1616
runs-on: ubuntu-latest
1717
steps:
18-
- name: Checkout Repo
19-
uses: actions/checkout@v4
18+
- uses: actions/checkout@v4
2019
with:
2120
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
2221
fetch-depth: 0
2322

24-
- uses: pnpm/action-setup@v3
23+
- uses: pnpm/action-setup@v4
24+
25+
- uses: actions/setup-node@v4
2526
with:
26-
version: 8
27+
node-version: 20
28+
cache: pnpm
2729

28-
- name: Setup Node.js
29-
uses: actions/setup-node@v4
30-
with:
31-
node-version: 18
32-
33-
# PNPM Store cache setup
34-
- name: Get pnpm store directory
35-
id: pnpm-cache
36-
run: |
37-
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
38-
- name: Setup pnpm cache
39-
uses: actions/cache@v4
40-
with:
41-
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
42-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
43-
restore-keys: |
44-
${{ runner.os }}-pnpm-store-
45-
46-
- run: pnpm install --frozen-lockfile
30+
- name: Install dependencies
31+
run: pnpm install
4732

4833
- name: Create Release Pull Request or Publish to npm
4934
id: changesets
@@ -55,3 +40,19 @@ jobs:
5540
env:
5641
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5742
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
43+
44+
- name: Build site
45+
if: steps.changesets.outputs.published == 'true'
46+
run: pnpm -F docs build
47+
48+
- name: Deploy to Cloudflare Pages
49+
if: steps.changesets.outputs.published == 'true'
50+
uses: AdrianGonz97/refined-cf-pages-action@v1
51+
with:
52+
apiToken: ${{ secrets.CF_API_TOKEN }}
53+
accountId: ${{ secrets.CF_ACCOUNT_ID }}
54+
githubToken: ${{ secrets.GITHUB_TOKEN }}
55+
projectName: runed
56+
directory: ./.svelte-kit/cloudflare
57+
workingDirectory: sites/docs
58+
deploymentName: Production

‎.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
engine-strict=true
2+
package-manager-strict=false

‎package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,6 @@
6262
"engines": {
6363
"pnpm": "^8.7.0",
6464
"node": ">=18"
65-
}
65+
},
66+
"packageManager": "pnpm@8.15.8"
6667
}

0 commit comments

Comments
 (0)
Please sign in to comment.