Skip to content

Commit b4bcb44

Browse files
authored
ci: create workflow to publish packages (#232)
1 parent 2541e9e commit b4bcb44

File tree

3 files changed

+48
-4
lines changed

3 files changed

+48
-4
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11

22
on:
3-
release:
4-
types: [published]
53
pull_request:
64
branches: '**'
75
paths-ignore:
@@ -39,4 +37,4 @@ jobs:
3937
uses: codecov/codecov-action@v5
4038
with:
4139
token: ${{ secrets.CODECOV_TOKEN }}
42-
40+

.github/workflows/release.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
on:
2+
release:
3+
types: [published]
4+
5+
name: Release
6+
jobs:
7+
release:
8+
name: Build and Publish
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
# check if tagged version matches federation-sdk version
14+
- name: Check version
15+
run: |
16+
TAG_VERSION="${{ github.event.release.tag_name }}"
17+
SDK_VERSION=$(jq -r '.version' packages/federation-sdk/package.json)
18+
if [ "$TAG_VERSION" != "$SDK_VERSION" ]; then
19+
echo "Tag version ($TAG_VERSION) does not match federation-sdk version ($SDK_VERSION)"
20+
exit 1
21+
fi
22+
23+
- name: Cache turbo build setup
24+
uses: actions/cache@v4
25+
with:
26+
path: .turbo
27+
key: ${{ runner.os }}-turbo-${{ github.sha }}
28+
restore-keys: |
29+
${{ runner.os }}-turbo-
30+
31+
- uses: oven-sh/setup-bun@v2
32+
33+
- run: bun install
34+
35+
- run: bun lint:ci
36+
37+
- run: bun test
38+
39+
- run: bun bundle:sdk
40+
41+
- name: Publish to NPM
42+
env:
43+
NPM_CONFIG_TOKEN: ${{ secrets.NPM_CONFIG_TOKEN }}
44+
run: |
45+
cd ./federation-bundle
46+
bun publish --access public

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@
5050
"lint:ci": "bunx @biomejs/biome ci --diagnostic-level=error",
5151
"lint:fix": "bunx @biomejs/biome lint --fix",
5252
"tsc": "tsc --noEmit",
53-
"bundle:sdk": "bun run bundle.ts"
53+
"bundle:sdk": "bun run build && bun run bundle.ts"
5454
}
5555
}

0 commit comments

Comments
 (0)