|
1 | 1 | name: Release
|
2 | 2 |
|
| 3 | +env: |
| 4 | + pnpm_store_path: ${{github.workspace}}/.pnpm-store |
| 5 | + |
3 | 6 | on:
|
4 | 7 | push:
|
5 | 8 | branches:
|
6 | 9 | - main
|
7 | 10 |
|
8 | 11 | jobs:
|
9 | 12 | release:
|
| 13 | + # prevents this action from running on forks |
| 14 | + if: github.repository == 'sveltejs/vite-plugin-svelte' |
10 | 15 | name: Release
|
11 | 16 | runs-on: ubuntu-latest
|
12 | 17 | 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 |
15 | 24 | with:
|
16 | 25 | # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
|
17 | 26 | fetch-depth: 0
|
18 | 27 |
|
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 |
21 | 44 | 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- |
23 | 50 |
|
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 |
26 | 59 |
|
27 | 60 | - name: Create Release Pull Request or Publish to npm
|
28 | 61 | id: changesets
|
|
0 commit comments