Skip to content

Commit 3171706

Browse files
committed
ci: add release workflow to publish kompkit-core to npm and pub.dev on release branch
1 parent a210a63 commit 3171706

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

.github/workflows/release.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [release]
6+
paths:
7+
- "packages/core/web/**"
8+
- "packages/core/flutter/**"
9+
- ".github/workflows/release.yml"
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
15+
concurrency:
16+
group: release
17+
cancel-in-progress: false
18+
19+
jobs:
20+
publish-npm:
21+
name: Publish to npm (kompkit-core)
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v4
27+
28+
- name: Setup Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: "20.x"
32+
registry-url: "https://registry.npmjs.org"
33+
cache: "npm"
34+
35+
- name: Install dependencies
36+
run: npm ci
37+
38+
- name: Build
39+
run: npm run build:web
40+
41+
- name: Run tests
42+
run: npm run test:web
43+
44+
- name: Publish to npm
45+
run: npm publish --access public
46+
working-directory: packages/core/web
47+
env:
48+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
49+
50+
publish-pub:
51+
name: Publish to pub.dev (kompkit_core)
52+
runs-on: ubuntu-latest
53+
54+
steps:
55+
- name: Checkout code
56+
uses: actions/checkout@v4
57+
58+
- name: Setup Flutter
59+
uses: subosito/flutter-action@v2
60+
with:
61+
flutter-version: "3.27.4"
62+
channel: "stable"
63+
64+
- name: Get dependencies
65+
working-directory: packages/core/flutter
66+
run: flutter pub get
67+
68+
- name: Analyze
69+
working-directory: packages/core/flutter
70+
run: flutter analyze
71+
72+
- name: Run tests
73+
working-directory: packages/core/flutter
74+
run: flutter test
75+
76+
- name: Setup pub credentials
77+
run: |
78+
mkdir -p $HOME/.config/dart
79+
echo '${{ secrets.PUB_CREDENTIALS }}' > $HOME/.config/dart/pub-credentials.json
80+
81+
- name: Publish to pub.dev
82+
working-directory: packages/core/flutter
83+
run: dart pub publish --force

0 commit comments

Comments
 (0)