Skip to content

update release action and scripts #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 40 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,61 @@
name: Release

env:
pnpm_store_path: ${{github.workspace}}/.pnpm-store

on:
push:
branches:
- main

jobs:
release:
# prevents this action from running on forks
if: github.repository == 'sveltejs/vite-plugin-svelte'
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master
- uses: actions/setup-node@v2
with:
node-version: 14

- name: checkout
uses: actions/checkout@v2
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Setup Node.js 12.x
uses: actions/setup-node@master
# install pnpm and try to reuse cache from ci action by using same cache keys
- name: install pnpm
run: npm i -g pnpm@5
- name: set pnpm store-dir
run: pnpm config set store-dir ${{ env.pnpm_store_path }}
- name: pnpm-store
uses: actions/cache@v2
id: pnpm-store
with:
path: ${{ env.pnpm_store_path }}
key: ubuntu-latest-node-v14-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}

- name: pnpm-store-fallback
if: steps.pnpm-store.outputs.cache-hit != 'true'
uses: actions/cache@v2
id: pnpm-store-fallback
with:
node-version: 12.x
path: ${{ env.pnpm_store_path }}
key: ubuntu-latest-node-v14-pnpm-store-fallback-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
ubuntu-latest-node-v14-pnpm-store-fallback-
ubuntu-latest-node-v14-pnpm-store-

- run: npm install -g pnpm
- run: pnpm install --frozen-lockfile
- name: install
# install but don't run scripts, they could be evil
run: pnpm install --frozen-lockfile --prefer-offline --ignore-scripts
- name: check store
run: pnpm store status
- name: install esbuild
# manually install esbuild because we deactivated postinstall scripts above
run: node node_modules/esbuild/install.js

- name: Create Release Pull Request or Publish to npm
id: changesets
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"format:fix": "pnpm format -- --write",
"fixup": "run-s lint:fix format:fix",
"update-deps": "ncu -u",
"release": "pnpm publish --tag=next --filter=\"@sveltejs/*\""
"release": "pnpm run build && pnpx changeset publish"
},
"devDependencies": {
"@changesets/cli": "^2.14.1",
Expand Down
3 changes: 1 addition & 2 deletions packages/vite-plugin-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
"dev": "tsc -p . -w --incremental",
"build": "rimraf dist && run-s build-bundle build-types",
"build-bundle": "node scripts/build-bundle.js",
"build-types": "tsc -p . --emitDeclarationOnly --outDir temp && api-extractor run && rimraf temp",
"prepublishOnly": "npm run build"
"build-types": "tsc -p . --emitDeclarationOnly --outDir temp && api-extractor run && rimraf temp"
},
"engines": {
"node": ">=12.0.0"
Expand Down