Skip to content

Commit afaf4ab

Browse files
authored
Merge pull request #21 from LGLabGreg/chore/changesets
chore: release workflow
2 parents fc77ed3 + 1d6e3eb commit afaf4ab

7 files changed

Lines changed: 3196 additions & 2146 deletions

File tree

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.0.5/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "restricted",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": ["**/dist/**"]
11+
}

.github/workflows/create-release.yml

Lines changed: 0 additions & 57 deletions
This file was deleted.

.github/workflows/manual-release.yml

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: Manual Release
33
on:
44
workflow_dispatch:
55
inputs:
6-
release_type:
7-
description: 'Release Type (patch/minor/major)'
6+
version:
7+
description: 'Version Type (patch/minor/major)'
88
required: true
99
type: choice
1010
options:
@@ -13,10 +13,12 @@ on:
1313
- major
1414

1515
jobs:
16-
create-release:
16+
release:
17+
name: Create Release PR
1718
runs-on: ubuntu-latest
1819
steps:
19-
- uses: actions/checkout@v4
20+
- name: Checkout Repo
21+
uses: actions/checkout@v4
2022
with:
2123
fetch-depth: 0
2224

@@ -44,35 +46,31 @@ jobs:
4446
restore-keys: |
4547
${{ runner.os }}-pnpm-store-
4648
47-
- name: Install dependencies
49+
- name: Install Dependencies
4850
run: pnpm install
4951

5052
- name: Setup Git
5153
run: |
5254
git config user.name 'github-actions[bot]'
5355
git config user.email 'github-actions[bot]@users.noreply.github.com'
5456
55-
- name: Update version
56-
working-directory: ./packages/react-qr-code
57+
- name: Create Changeset
5758
run: |
58-
npm version ${{ github.event.inputs.release_type }} --no-git-tag-version
59-
echo "NEW_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
59+
pnpm changeset add --empty
60+
echo "# @lglab/react-qr-code\n\n${{ github.event.inputs.version }} release" > .changeset/release.md
6061
61-
- name: Build library
62-
run: pnpm run build:lib
63-
64-
- name: Create release branch
62+
- name: Update Version
63+
id: create_version_pr
6564
run: |
66-
git checkout -b release/v${{ env.NEW_VERSION }}
67-
git add .
68-
git commit -m "chore: release v${{ env.NEW_VERSION }}"
69-
git push origin release/v${{ env.NEW_VERSION }}
65+
pnpm changeset version
66+
NEW_VERSION=$(node -p "require('./packages/react-qr-code/package.json').version")
67+
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
7068
71-
- name: Create Pull Request
72-
uses: repo-sync/pull-request@v2
69+
- name: Create PR
70+
uses: changesets/action@v1
7371
with:
74-
github_token: ${{ secrets.GITHUB_TOKEN }}
75-
destination_branch: 'main'
76-
source_branch: 'release/v${{ env.NEW_VERSION }}'
77-
pr_title: 'chore: release v${{ env.NEW_VERSION }}'
78-
pr_body: '🎉 New Release Version: v${{ env.NEW_VERSION }}'
72+
commit: 'chore: release v${{ env.NEW_VERSION }}'
73+
title: 'New release v${{ env.NEW_VERSION }}'
74+
createGithubReleases: false
75+
env:
76+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Publish Release
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches:
7+
- main
8+
9+
jobs:
10+
release:
11+
name: Publish Release
12+
if: github.event.pull_request.merged == true && contains(github.event.pull_request.title, 'New release v')
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout Repo
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '20.x'
24+
registry-url: 'https://registry.npmjs.org'
25+
26+
- name: Install pnpm
27+
uses: pnpm/action-setup@v3
28+
with:
29+
version: 9
30+
31+
- name: Install Dependencies
32+
run: pnpm install
33+
34+
- name: Build
35+
run: pnpm run build:lib
36+
37+
- name: Create Release
38+
id: create-release
39+
uses: changesets/action@v1
40+
with:
41+
publish: pnpm changeset publish
42+
createGithubReleases: true
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
]
2424
},
2525
"devDependencies": {
26+
"@changesets/cli": "^2.27.12",
2627
"@eslint/js": "^9.19.0",
2728
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
2829
"concurrently": "^9.1.2",

0 commit comments

Comments
 (0)