Skip to content

Commit 0e516a3

Browse files
authored
update release action and scripts (#18)
* update release action and scripts * always run install on release action, unlike ci it isn't multi-job with deferred install
1 parent 6f4a253 commit 0e516a3

File tree

3 files changed

+42
-10
lines changed

3 files changed

+42
-10
lines changed

.github/workflows/release.yml

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,61 @@
11
name: Release
22

3+
env:
4+
pnpm_store_path: ${{github.workspace}}/.pnpm-store
5+
36
on:
47
push:
58
branches:
69
- main
710

811
jobs:
912
release:
13+
# prevents this action from running on forks
14+
if: github.repository == 'sveltejs/vite-plugin-svelte'
1015
name: Release
1116
runs-on: ubuntu-latest
1217
steps:
13-
- name: Checkout Repo
14-
uses: actions/checkout@master
18+
- uses: actions/setup-node@v2
19+
with:
20+
node-version: 14
21+
22+
- name: checkout
23+
uses: actions/checkout@v2
1524
with:
1625
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
1726
fetch-depth: 0
1827

19-
- name: Setup Node.js 12.x
20-
uses: actions/setup-node@master
28+
# install pnpm and try to reuse cache from ci action by using same cache keys
29+
- name: install pnpm
30+
run: npm i -g pnpm@5
31+
- name: set pnpm store-dir
32+
run: pnpm config set store-dir ${{ env.pnpm_store_path }}
33+
- name: pnpm-store
34+
uses: actions/cache@v2
35+
id: pnpm-store
36+
with:
37+
path: ${{ env.pnpm_store_path }}
38+
key: ubuntu-latest-node-v14-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
39+
40+
- name: pnpm-store-fallback
41+
if: steps.pnpm-store.outputs.cache-hit != 'true'
42+
uses: actions/cache@v2
43+
id: pnpm-store-fallback
2144
with:
22-
node-version: 12.x
45+
path: ${{ env.pnpm_store_path }}
46+
key: ubuntu-latest-node-v14-pnpm-store-fallback-${{ hashFiles('**/pnpm-lock.yaml') }}
47+
restore-keys: |
48+
ubuntu-latest-node-v14-pnpm-store-fallback-
49+
ubuntu-latest-node-v14-pnpm-store-
2350
24-
- run: npm install -g pnpm
25-
- run: pnpm install --frozen-lockfile
51+
- name: install
52+
# install but don't run scripts, they could be evil
53+
run: pnpm install --frozen-lockfile --prefer-offline --ignore-scripts
54+
- name: check store
55+
run: pnpm store status
56+
- name: install esbuild
57+
# manually install esbuild because we deactivated postinstall scripts above
58+
run: node node_modules/esbuild/install.js
2659

2760
- name: Create Release Pull Request or Publish to npm
2861
id: changesets

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"format:fix": "pnpm format -- --write",
2525
"fixup": "run-s lint:fix format:fix",
2626
"update-deps": "ncu -u",
27-
"release": "pnpm publish --tag=next --filter=\"@sveltejs/*\""
27+
"release": "pnpm run build && pnpx changeset publish"
2828
},
2929
"devDependencies": {
3030
"@changesets/cli": "^2.14.1",

packages/vite-plugin-svelte/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
"dev": "tsc -p . -w --incremental",
1313
"build": "rimraf dist && run-s build-bundle build-types",
1414
"build-bundle": "node scripts/build-bundle.js",
15-
"build-types": "tsc -p . --emitDeclarationOnly --outDir temp && api-extractor run && rimraf temp",
16-
"prepublishOnly": "npm run build"
15+
"build-types": "tsc -p . --emitDeclarationOnly --outDir temp && api-extractor run && rimraf temp"
1716
},
1817
"engines": {
1918
"node": ">=12.0.0"

0 commit comments

Comments
 (0)