Skip to content

Commit 0a4c3e2

Browse files
committed
Add release workflow
1 parent d36ef50 commit 0a4c3e2

File tree

3 files changed

+54
-3
lines changed

3 files changed

+54
-3
lines changed

.changeset/config.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"commit": false,
55
"fixed": [],
66
"linked": [],
7-
"access": "restricted",
7+
"access": "public",
88
"baseBranch": "main",
9-
"updateInternalDependencies": "patch",
9+
"updateInternalDependencies": "minor",
1010
"ignore": []
1111
}

.github/workflows/release.yml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency: ${{ github.workflow }}-${{ github.ref }}
9+
10+
jobs:
11+
release:
12+
name: Release
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout Repo
16+
uses: actions/checkout@v3
17+
18+
- name: Setup Node.js 16.x
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: 16.x
22+
23+
- name: Install Dependencies
24+
run: yarn
25+
26+
# This step will run changeset version, setting the step output to if there were changesets found
27+
- name: Version command
28+
id: version
29+
run: |
30+
echo ::set-output name=changes::$(npx changeset version 2>&1 | grep -q 'No unreleased changesets found' && echo 'false' || echo 'true')
31+
32+
- name: Release packages
33+
if: steps.version.outputs.changes == 'true'
34+
uses: changesets/action@main
35+
with:
36+
publish: yarn release
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
40+
41+
- name: Push changes
42+
if: steps.version.outputs.changes == 'true'
43+
run: |
44+
git config user.email "<email>"
45+
git config user.name "<name>"
46+
git add -A
47+
git commit -m "New version" || echo "No changes to commit"
48+
git push
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"scripts": {
1111
"changeset": "changeset",
1212
"version": "changeset version",
13-
"release": "changeset publish"
13+
"build": "yarn workspace @code-hike/lighter build",
14+
"release": "yarn build && changeset publish"
1415
},
1516
"repository": "code-hike/lighter",
1617
"author": "pomber",

0 commit comments

Comments
 (0)