Skip to content

Commit 6d19e23

Browse files
committed
chore: restore GitHub Actions workflows
1 parent d2b10a7 commit 6d19e23

4 files changed

Lines changed: 305 additions & 0 deletions

File tree

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Build Android
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
paths:
11+
- '.github/workflows/android-build.yml'
12+
- 'src/**'
13+
- 'package.json'
14+
- 'package-lock.json'
15+
- 'example/android/**'
16+
- 'nitrogen/generated/shared/**'
17+
- 'nitrogen/generated/android/**'
18+
- 'cpp/**'
19+
- 'android/**'
20+
- '**/bun.lock'
21+
- '**/react-native.config.js'
22+
- '**/nitro.json'
23+
pull_request:
24+
paths:
25+
- '.github/workflows/android-build.yml'
26+
- 'src/**'
27+
- 'package.json'
28+
- 'package-lock.json'
29+
- 'example/android/**'
30+
- '**/nitrogen/generated/shared/**'
31+
- '**/nitrogen/generated/android/**'
32+
- 'cpp/**'
33+
- 'android/**'
34+
- '**/bun.lock'
35+
- '**/react-native.config.js'
36+
- '**/nitro.json'
37+
workflow_dispatch:
38+
39+
concurrency:
40+
group: ${{ github.workflow }}-${{ github.ref }}
41+
cancel-in-progress: true
42+
43+
jobs:
44+
build:
45+
name: Build Android Example App
46+
runs-on: ubuntu-latest
47+
steps:
48+
- uses: actions/checkout@v6
49+
- uses: oven-sh/setup-bun@v2
50+
51+
- name: Install dependencies (bun)
52+
run: bun install
53+
54+
- name: Setup JDK 17
55+
uses: actions/setup-java@v5
56+
with:
57+
distribution: 'zulu'
58+
java-version: '17'
59+
cache: 'gradle'
60+
61+
- name: Cache Gradle
62+
uses: actions/cache@v5
63+
with:
64+
path: |
65+
~/.gradle/caches
66+
~/.gradle/wrapper
67+
key: ${{ runner.os }}-gradle-${{ hashFiles('example/android/**/*.gradle*') }}
68+
restore-keys: |
69+
${{ runner.os }}-gradle-
70+
71+
- name: Run Gradle build
72+
working-directory: example/android
73+
run: ./gradlew assembleDebug --no-daemon --build-cache
74+
75+
- name: Stop Gradle daemon
76+
working-directory: example/android
77+
run: ./gradlew --stop
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Publish GitHub Package
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types:
7+
- published
8+
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: false
15+
16+
jobs:
17+
publish:
18+
name: Publish GitHub Package
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
packages: write
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v6
26+
27+
- name: Setup Node.js
28+
uses: actions/setup-node@v5
29+
with:
30+
node-version: 22
31+
registry-url: https://npm.pkg.github.com
32+
scope: '@munimtechnologies'
33+
cache: npm
34+
35+
- name: Install npm dependencies
36+
run: npm ci
37+
38+
- name: Build lib
39+
run: npm run build
40+
41+
- name: Prepare GitHub package manifest
42+
run: |
43+
node <<'NODE'
44+
const fs = require('fs')
45+
46+
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'))
47+
pkg.name = '@munimtechnologies/munim-bluetooth'
48+
pkg.publishConfig = {
49+
access: 'public',
50+
registry: 'https://npm.pkg.github.com/',
51+
}
52+
pkg.repository = {
53+
type: 'git',
54+
url: 'git+https://github.com/munimtechnologies/munim-bluetooth.git',
55+
}
56+
57+
fs.writeFileSync('package.json', `${JSON.stringify(pkg, null, 2)}\n`)
58+
NODE
59+
60+
- name: Publish to GitHub Packages
61+
env:
62+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
run: |
64+
set -euo pipefail
65+
66+
package_name="$(node -p "require('./package.json').name")"
67+
package_version="$(node -p "require('./package.json').version")"
68+
69+
if npm view "${package_name}@${package_version}" version --registry=https://npm.pkg.github.com >/dev/null 2>&1; then
70+
echo "${package_name}@${package_version} is already published to GitHub Packages."
71+
exit 0
72+
fi
73+
74+
npm publish --registry=https://npm.pkg.github.com --access public

.github/workflows/ios-build.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Build iOS
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
paths:
11+
- '.github/workflows/ios-build.yml'
12+
- 'src/**'
13+
- 'package.json'
14+
- 'package-lock.json'
15+
- 'example/ios/**'
16+
- 'example/Gemfile'
17+
- 'example/Gemfile.lock'
18+
- '**/nitrogen/generated/shared/**'
19+
- '**/nitrogen/generated/ios/**'
20+
- 'cpp/**'
21+
- 'ios/**'
22+
- '**/Podfile.lock'
23+
- '**/bun.lock'
24+
- '**/*.podspec'
25+
- '**/react-native.config.js'
26+
- '**/nitro.json'
27+
pull_request:
28+
paths:
29+
- '.github/workflows/ios-build.yml'
30+
- 'src/**'
31+
- 'package.json'
32+
- 'package-lock.json'
33+
- 'example/ios/**'
34+
- 'example/Gemfile'
35+
- 'example/Gemfile.lock'
36+
- '**/nitrogen/generated/shared/**'
37+
- '**/nitrogen/generated/ios/**'
38+
- 'cpp/**'
39+
- 'ios/**'
40+
- '**/Podfile.lock'
41+
- '**/bun.lock'
42+
- '**/*.podspec'
43+
- '**/react-native.config.js'
44+
- '**/nitro.json'
45+
workflow_dispatch:
46+
47+
env:
48+
USE_CCACHE: 1
49+
50+
concurrency:
51+
group: ${{ github.workflow }}-${{ github.ref }}
52+
cancel-in-progress: true
53+
54+
jobs:
55+
build:
56+
name: Build iOS Example App
57+
runs-on: macos-26
58+
steps:
59+
- uses: actions/checkout@v6
60+
- uses: oven-sh/setup-bun@v2
61+
- name: Setup Xcode
62+
uses: maxim-lobanov/setup-xcode@v1
63+
with:
64+
xcode-version: 26.4
65+
66+
- name: Install dependencies (bun)
67+
run: bun install
68+
69+
- name: Setup Ruby (bundle)
70+
uses: ruby/setup-ruby@v1
71+
with:
72+
ruby-version: '3.2'
73+
bundler-cache: true
74+
working-directory: example/ios
75+
76+
- name: Install xcpretty
77+
run: gem install xcpretty
78+
79+
- name: Cache CocoaPods
80+
uses: actions/cache@v5
81+
with:
82+
path: |
83+
~/.cocoapods/repos
84+
example/ios/Pods
85+
key: ${{ runner.os }}-pods-${{ hashFiles('example/ios/Podfile.lock') }}
86+
restore-keys: |
87+
${{ runner.os }}-pods-
88+
89+
- name: Install Pods
90+
working-directory: example/ios
91+
run: pod install
92+
93+
- name: Build App
94+
working-directory: example/ios
95+
run: |
96+
set -o pipefail && xcodebuild \
97+
CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ \
98+
-derivedDataPath build -UseModernBuildSystem=YES \
99+
-workspace MunimBluetoothExample.xcworkspace \
100+
-scheme MunimBluetoothExample \
101+
-configuration Debug \
102+
-destination 'generic/platform=iOS' \
103+
build \
104+
CODE_SIGNING_ALLOWED=NO | xcpretty

.github/workflows/release.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
release:
15+
name: Release
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: write
19+
issues: write
20+
pull-requests: write
21+
id-token: write
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
25+
with:
26+
fetch-depth: 0
27+
- name: Setup Node.js
28+
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5
29+
with:
30+
node-version: 22
31+
registry-url: https://registry.npmjs.org
32+
cache: npm
33+
34+
- name: Install npm dependencies
35+
run: npm ci
36+
37+
- name: Build lib
38+
run: npm run build
39+
40+
- name: Release
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
44+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
45+
NPM_CONFIG_PROVENANCE: true
46+
GIT_AUTHOR_NAME: ${{ github.actor }}
47+
GIT_AUTHOR_EMAIL: '${{ github.actor }}@users.noreply.github.com'
48+
GIT_COMMITTER_NAME: ${{ github.actor }}
49+
GIT_COMMITTER_EMAIL: '${{ github.actor }}@users.noreply.github.com'
50+
run: npm run release

0 commit comments

Comments
 (0)