Skip to content

Commit f6b2b64

Browse files
authored
Configure publishing workflow (#34)
* add and init changesets * add release workflow * extract node version into env var
1 parent e07c6c6 commit f6b2b64

File tree

5 files changed

+557
-7
lines changed

5 files changed

+557
-7
lines changed

.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.1.1/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.github/workflows/release.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency: ${{ github.workflow }}-${{ github.ref }}
9+
10+
env:
11+
NODE_VERSION: '20.x'
12+
PNPM_VERSION: '10.20.0'
13+
14+
jobs:
15+
release:
16+
name: Release
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout Repo
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: ${{ env.NODE_VERSION }}
26+
27+
- name: Setup pnpm
28+
uses: pnpm/action-setup@v4
29+
with:
30+
version: ${{ env.PNPM_VERSION }}
31+
32+
- name: Get pnpm store directory
33+
id: pnpm-cache
34+
shell: bash
35+
run: |
36+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
37+
38+
- name: Setup pnpm cache
39+
uses: actions/cache@v4
40+
with:
41+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
42+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
43+
restore-keys: |
44+
${{ runner.os }}-pnpm-store-
45+
46+
- name: Install dependencies
47+
run: pnpm install --frozen-lockfile
48+
49+
- name: Create Release Pull Request or Publish to npm
50+
id: changesets
51+
uses: changesets/action@v1
52+
with:
53+
publish: pnpm release
54+
env:
55+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"files": [
1515
"dist/"
1616
],
17+
"publishConfig": {
18+
"access": "public"
19+
},
1720
"scripts": {
1821
"build": "tsc",
1922
"test": "vitest run",
@@ -22,13 +25,15 @@
2225
"test:examples": "pnpm --filter cart-validation-js-tests test && pnpm --filter discount-function-rs-tests test",
2326
"lint": "eslint src/ test/",
2427
"lint:fix": "eslint src/ test/ --fix",
25-
"prepublishOnly": "pnpm run build && pnpm run test && pnpm run lint"
28+
"prepublishOnly": "pnpm run build && pnpm run test && pnpm run lint",
29+
"release": "pnpm run build && changeset publish"
2630
},
2731
"dependencies": {
2832
"core-js": "^3.46.0",
2933
"graphql": "^16.11.0"
3034
},
3135
"devDependencies": {
36+
"@changesets/cli": "^2.29.7",
3237
"@shopify/eslint-plugin": "^50.0.0",
3338
"@types/node": "^22.18.6",
3439
"@typescript-eslint/eslint-plugin": "^8.46.2",

0 commit comments

Comments
 (0)