Skip to content

Commit 8e0d108

Browse files
authored
ci: release and nightly release automation (#230)
* feat: release and nightly release automation * fix: nightly npm badge
1 parent 17d7fb6 commit 8e0d108

File tree

8 files changed

+477
-46
lines changed

8 files changed

+477
-46
lines changed

.github/workflows/ci.yml

+44-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
- main
1010

1111
jobs:
12-
ci:
12+
test:
1313
runs-on: ${{ matrix.os }}
1414

1515
strategy:
@@ -47,3 +47,46 @@ jobs:
4747

4848
- name: Build project
4949
run: pnpm build
50+
51+
- name: Cache dist
52+
uses: actions/cache@v4
53+
with:
54+
path: dist
55+
key: ${{ matrix.os }}-node-v${{ matrix.node }}-${{ github.sha }}
56+
57+
nightly-release:
58+
needs:
59+
- test
60+
runs-on: ${{ matrix.os }}
61+
strategy:
62+
matrix:
63+
node: [18]
64+
os: [ubuntu-latest]
65+
steps:
66+
- uses: actions/checkout@v4
67+
68+
- run: corepack enable
69+
70+
- uses: actions/setup-node@v4
71+
with:
72+
node-version: ${{ matrix.node }}
73+
cache: pnpm
74+
75+
- name: Install dependencies
76+
run: pnpm install --frozen-lockfile
77+
78+
- name: Restore dist cache
79+
uses: actions/cache@v4
80+
with:
81+
path: dist
82+
key: ${{ matrix.os }}-node-v${{ matrix.node }}-${{ github.sha }}
83+
84+
- name: Release Nightly
85+
if: |
86+
github.event_name == 'push' &&
87+
!startsWith(github.event.head_commit.message, '[skip-release]') &&
88+
!startsWith(github.event.head_commit.message, 'chore') &&
89+
!startsWith(github.event.head_commit.message, 'docs')
90+
run: ./scripts/release-nightly.sh
91+
env:
92+
NPM_TOKEN: ${{secrets.NPM_TOKEN}}

.github/workflows/release.yaml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Release
2+
3+
# trigger by `git tag` push only via `yarn release`
4+
on:
5+
push:
6+
branches-ignore:
7+
- '**'
8+
tags:
9+
- 'v*'
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout codes
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Enable corepack
21+
run: corepack enable
22+
23+
- name: Setup node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: 18
27+
cache: pnpm
28+
29+
- name: Install dependencies
30+
run: pnpm install --frozen-lockfile
31+
32+
- name: Create github releases
33+
run: |
34+
npx changelogithub
35+
env:
36+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
37+
38+
- name: Extract version tag
39+
if: startsWith( github.ref, 'refs/tags/v' )
40+
uses: jungwinter/split@v2
41+
id: split
42+
with:
43+
msg: ${{ github.ref }}
44+
separator: /
45+
46+
- name: Sync changelog from github releases
47+
run: |
48+
pnpm changelog --tag=${{ steps.split.outputs._2 }}
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
52+
- name: Commit changelog
53+
uses: stefanzweifel/git-auto-commit-action@v5
54+
with:
55+
branch: main
56+
file_pattern: CHANGELOG.md
57+
commit_message: 'chore: generate changelog'
58+
59+
- name: Publish package
60+
run: ./scripts/release.sh
61+
env:
62+
NPM_TOKEN: ${{secrets.NPM_TOKEN}}

README.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# 🤹 @vueuse/motion
22

33
[![npm](https://img.shields.io/npm/v/@vueuse/motion.svg)](https://www.npmjs.com/package/@vueuse/motion)
4+
[![npm](https://img.shields.io/npm/v/@vueuse/motion-nightly.svg)](https://www.npmjs.com/package/@vueuse/motion-nightly)
45
[![npm](https://img.shields.io/npm/dm/@vueuse/motion.svg)](https://npm-stat.com/charts.html?package=@vueuse/motion)
56
[![Netlify Status](https://api.netlify.com/api/v1/badges/ab1db459-8420-4bc6-9fac-2bc247fa2385/deploy-status)](https://app.netlify.com/sites/vueuse-motion/deploys)
67

@@ -25,7 +26,7 @@ Let's get started by installing the package and adding the plugin.
2526
From your terminal:
2627

2728
```bash
28-
yarn add @vueuse/motion
29+
npm install @vueuse/motion
2930
```
3031

3132
In your Vue app entry file:
@@ -70,6 +71,14 @@ To see more about what are variants and how you can use them, check out [Variant
7071

7172
To see more about how to control your declared variants, check out [Motion Instance](https://motion.vueuse.org/features/motion-instance).
7273

74+
## Nightly release channel
75+
76+
You can try out the latest changes before a stable release by installing the nightly release channel.
77+
78+
```bash
79+
npm install @vueuse/motion@npm:@vueuse/motion-nightly
80+
```
81+
7382
## Credits
7483

7584
This package is heavily inspired by [Framer Motion](https://www.framer.com/motion/) by [@mattgperry](https://twitter.com/mattgperry).

package.json

+7-18
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,15 @@
5050
"build": "unbuild && pnpm build:nuxt-module",
5151
"build:nuxt-module": "nuxt-module-build build ./src/nuxt --outDir ../../dist/nuxt",
5252
"dev": "pnpm dev:vite",
53-
"release": "release-it",
5453
"lint": "eslint .",
5554
"lint:fix": "eslint . --fix",
5655
"test:unit": "vitest run",
5756
"test:coverage": "vitest run --coverage",
5857
"test": "pnpm test:unit && pnpm test:coverage",
5958
"prepare": "pnpm prepare:nuxt && pnpm prepare:docs",
59+
"prepack": "pnpm build",
60+
"release": "bumpp --commit \"release: v%s\" --push --tag",
61+
"changelog": "gh-changelogen --repo=vueuse/motion",
6062
"__": "__",
6163
"dev:nuxt": "(cd playgrounds/nuxt && pnpm dev:nuxt)",
6264
"build:nuxt": "(cd playgrounds/nuxt && pnpm build:nuxt)",
@@ -94,9 +96,13 @@
9496
"@nuxt/schema": "^3.13.0",
9597
"@vitest/coverage-v8": "^1.6.0",
9698
"@vue/test-utils": "^2.4.6",
99+
"bumpp": "^9.5.2",
100+
"changelogithub": "^0.13.10",
97101
"chokidar": "^3.6.0",
98102
"eslint": "^9.3.0",
103+
"gh-changelogen": "^0.2.8",
99104
"happy-dom": "^14.12.0",
105+
"jiti": "^1.21.6",
100106
"lint-staged": "^15.2.5",
101107
"nuxt": "^3.13.0",
102108
"pkg-pr-new": "^0.0.20",
@@ -126,22 +132,5 @@
126132
"vite": "^4.0.0"
127133
}
128134
}
129-
},
130-
"release-it": {
131-
"hooks": {
132-
"before:init": [
133-
"pnpm build"
134-
]
135-
},
136-
"npm": {
137-
"access": "public"
138-
},
139-
"git": {
140-
"commitMessage": "chore(release): release v${version}"
141-
},
142-
"github": {
143-
"release": true,
144-
"releaseName": "v${version}"
145-
}
146135
}
147136
}

0 commit comments

Comments
 (0)