Skip to content

Commit 13aa7ea

Browse files
committed
ci: add and update workflows for testing, release, and deployment
1 parent e27a751 commit 13aa7ea

File tree

4 files changed

+263
-15
lines changed

4 files changed

+263
-15
lines changed

.github/workflows/ci.yml

Lines changed: 93 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,103 @@ name: CI
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main, develop]
66
pull_request:
7-
branches: [ main ]
7+
branches: [main, develop]
88

99
jobs:
10-
build:
10+
build-react-lib:
11+
name: Build React Library
1112
runs-on: ubuntu-latest
13+
defaults:
14+
run:
15+
working-directory: packages/react
16+
steps:
17+
- uses: actions/checkout@v3
18+
- uses: actions/setup-node@v3
19+
with:
20+
node-version: 18
21+
cache: 'npm'
22+
- run: npm ci
23+
- run: npm run build --if-present
1224

13-
strategy:
14-
matrix:
15-
node-version: [14.x, 16.x, 18.x]
25+
build-vue-lib:
26+
name: Build Vue Library
27+
runs-on: ubuntu-latest
28+
defaults:
29+
run:
30+
working-directory: packages/vue
31+
steps:
32+
- uses: actions/checkout@v3
33+
- uses: actions/setup-node@v3
34+
with:
35+
node-version: 18
36+
cache: 'npm'
37+
- run: npm ci
38+
- run: npm run build --if-present
1639

40+
build-android-lib:
41+
name: Build Android Library
42+
runs-on: ubuntu-latest
43+
defaults:
44+
run:
45+
working-directory: packages/android
46+
steps:
47+
- uses: actions/checkout@v3
48+
- name: Set up JDK
49+
uses: actions/setup-java@v3
50+
with:
51+
distribution: 'temurin'
52+
java-version: 17
53+
- name: Grant Gradle permission
54+
run: chmod +x ./gradlew || true
55+
- name: Build with Gradle
56+
run: ./gradlew build
57+
58+
build-react-playground:
59+
name: Build React Playground
60+
runs-on: ubuntu-latest
61+
defaults:
62+
run:
63+
working-directory: playground/react-example
64+
steps:
65+
- uses: actions/checkout@v3
66+
- uses: actions/setup-node@v3
67+
with:
68+
node-version: 18
69+
cache: 'npm'
70+
- run: npm ci
71+
- run: npm run build
72+
73+
build-vue-playground:
74+
name: Build Vue Playground
75+
runs-on: ubuntu-latest
76+
defaults:
77+
run:
78+
working-directory: playground/vue-example
79+
steps:
80+
- uses: actions/checkout@v3
81+
- uses: actions/setup-node@v3
82+
with:
83+
node-version: 18
84+
cache: 'npm'
85+
- run: npm ci
86+
- run: npm run build
87+
88+
build-android-playground:
89+
name: Build Android Playground
90+
runs-on: ubuntu-latest
91+
defaults:
92+
run:
93+
working-directory: playground/android-example
1794
steps:
18-
- uses: actions/checkout@v3
19-
- name: Use Node.js ${{ matrix.node-version }}
20-
uses: actions/setup-node@v3
21-
with:
22-
node-version: ${{ matrix.node-version }}
23-
cache: 'npm'
24-
- run: npm ci
25-
- run: npm run build --if-present
26-
- run: npm test --if-present
95+
- uses: actions/checkout@v3
96+
- name: Set up JDK
97+
uses: actions/setup-java@v3
98+
with:
99+
distribution: 'temurin'
100+
java-version: 17
101+
- name: Grant Gradle permission
102+
run: chmod +x ./gradlew
103+
- name: Build with Gradle
104+
run: ./gradlew build

.github/workflows/playground.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Deploy Playground
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'playground/**'
8+
9+
jobs:
10+
deploy-vue:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-node@v3
15+
with:
16+
node-version: '18.x'
17+
cache: 'npm'
18+
- run: npm ci
19+
working-directory: playground/vue-example
20+
- run: npm run build
21+
working-directory: playground/vue-example
22+
- uses: peaceiris/actions-gh-pages@v3
23+
with:
24+
github_token: ${{ secrets.GITHUB_TOKEN }}
25+
publish_dir: playground/vue-example/dist
26+
destination_dir: vue
27+
persist-credentials: false
28+
clean: true
29+
30+
deploy-react:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v3
34+
- uses: actions/setup-node@v3
35+
with:
36+
node-version: '18.x'
37+
cache: 'npm'
38+
- run: npm ci
39+
working-directory: playground/react-example
40+
- run: npm run build
41+
working-directory: playground/react-example
42+
- uses: peaceiris/actions-gh-pages@v3
43+
with:
44+
github_token: ${{ secrets.GITHUB_TOKEN }}
45+
publish_dir: playground/react-example/dist
46+
destination_dir: react
47+
persist-credentials: false
48+
clean: true
49+
50+
deploy-android:
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v3
54+
- name: Set up JDK
55+
uses: actions/setup-java@v3
56+
with:
57+
distribution: 'temurin'
58+
java-version: '17'
59+
- name: Build APK
60+
run: ./gradlew assembleDebug
61+
working-directory: playground/android-example
62+
- name: Upload APK artifact
63+
uses: actions/upload-artifact@v3
64+
with:
65+
name: android-playground-debug
66+
path: playground/android-example/app/build/outputs/apk/debug/app-debug.apk

.github/workflows/release.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Release and Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- name: Create Release
14+
id: create_release
15+
uses: actions/create-release@v1
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
with:
19+
tag_name: ${{ github.ref }}
20+
release_name: Release ${{ github.ref }}
21+
draft: false
22+
prerelease: false
23+
24+
publish-npm:
25+
needs: release
26+
runs-on: ubuntu-latest
27+
strategy:
28+
matrix:
29+
package: [vue, react]
30+
steps:
31+
- uses: actions/checkout@v3
32+
- uses: actions/setup-node@v3
33+
with:
34+
node-version: '18.x'
35+
registry-url: 'https://registry.npmjs.org'
36+
- name: Install dependencies
37+
run: npm ci
38+
working-directory: packages/${{ matrix.package }}
39+
- name: Build package
40+
run: npm run build
41+
working-directory: packages/${{ matrix.package }}
42+
- name: Publish to NPM
43+
run: npm publish --access public
44+
working-directory: packages/${{ matrix.package }}
45+
env:
46+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
47+
48+
publish-android:
49+
needs: release
50+
runs-on: ubuntu-latest
51+
steps:
52+
- uses: actions/checkout@v3
53+
- name: Set up JDK
54+
uses: actions/setup-java@v3
55+
with:
56+
distribution: 'temurin'
57+
java-version: '17'
58+
- name: Build AAR
59+
run: ./gradlew assembleRelease
60+
working-directory: packages/android
61+
- name: Publish to GitHub Packages
62+
run: ./gradlew publish
63+
working-directory: packages/android
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
USERNAME: ${{ github.actor }}

.github/workflows/test.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
jobs:
10+
test-react-lib:
11+
name: Test React Library
12+
runs-on: ubuntu-latest
13+
defaults:
14+
run:
15+
working-directory: packages/react
16+
steps:
17+
- uses: actions/checkout@v3
18+
- uses: actions/setup-node@v3
19+
with:
20+
node-version: 18
21+
cache: 'npm'
22+
- run: npm ci
23+
- run: npm test --if-present
24+
25+
test-vue-lib:
26+
name: Test Vue Library
27+
runs-on: ubuntu-latest
28+
defaults:
29+
run:
30+
working-directory: packages/vue
31+
steps:
32+
- uses: actions/checkout@v3
33+
- uses: actions/setup-node@v3
34+
with:
35+
node-version: 18
36+
cache: 'npm'
37+
- run: npm ci
38+
- run: npm test --if-present

0 commit comments

Comments
 (0)