Skip to content

Commit 37f4104

Browse files
Merge pull request #21 from mendix/improve-github-actions
2 parents 6ebb8e3 + 97cc147 commit 37f4104

File tree

6 files changed

+168
-40
lines changed

6 files changed

+168
-40
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: 'Setup Project'
2+
description: 'Checkout code, setup Node.js, enable Yarn, and install dependencies'
3+
4+
runs:
5+
using: 'composite'
6+
steps:
7+
- name: Setup Node
8+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
9+
with:
10+
node-version-file: '.nvmrc'
11+
cache: yarn
12+
13+
- name: Enable corepack
14+
shell: bash
15+
run: corepack enable
16+
17+
- name: Install dependencies
18+
shell: bash
19+
run: yarn install --immutable
20+
21+
- name: Prepare package
22+
shell: bash
23+
run: yarn prepare
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Build Android Example
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
build-android-example:
8+
name: Build Android Example
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
14+
15+
- name: Setup Project
16+
uses: ./.github/actions/setup-node-yarn
17+
18+
- name: Setup Java
19+
uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e
20+
with:
21+
distribution: 'zulu'
22+
java-version: '17'
23+
24+
- name: Setup Android SDK
25+
uses: android-actions/setup-android@9fc6c4e9069bf8d3d10b2204b1fb8f6ef7065407
26+
27+
- name: Install NDK
28+
run: echo "y" | ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install "ndk;27.1.12297006"
29+
30+
- name: Build with Gradle
31+
run: ./gradlew assembleDebug
32+
working-directory: example/android

.github/workflows/build-ios.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Build iOS Example
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
build-ios-example:
8+
name: Build iOS Example
9+
runs-on: macos-latest
10+
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
14+
15+
- name: Setup Project
16+
uses: ./.github/actions/setup-node-yarn
17+
18+
- name: Setup Xcode
19+
run: sudo xcode-select -s /Applications/Xcode_26.1.app
20+
21+
- name: Setup Ruby
22+
uses: ruby/setup-ruby@d697be2f83c6234b20877c3b5eac7a7f342f0d0c
23+
with:
24+
ruby-version: '3.2'
25+
bundler-cache: true
26+
working-directory: example/ios
27+
28+
- name: Cache CocoaPods
29+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
30+
with:
31+
path: |
32+
example/ios/Pods
33+
~/Library/Caches/CocoaPods
34+
~/.cocoapods
35+
key: ${{ runner.os }}-pods-${{ hashFiles('example/ios/Podfile.lock') }}
36+
restore-keys: |
37+
${{ runner.os }}-pods-
38+
39+
- name: Install CocoaPods
40+
working-directory: example/ios
41+
run: |
42+
bundle install
43+
bundle exec pod install
44+
45+
- name: Build iOS example for simulator
46+
working-directory: example/ios
47+
run: |
48+
xcodebuild \
49+
-workspace MendixNativeExample.xcworkspace \
50+
-scheme MendixNativeExample \
51+
-configuration Debug \
52+
-sdk iphonesimulator \
53+
-destination 'platform=iOS Simulator,name=iPhone 17,OS=latest' \
54+
-derivedDataPath build \
55+
CODE_SIGNING_ALLOWED=NO \
56+
CODE_SIGNING_REQUIRED=NO \
57+
build

.github/workflows/ci.yml

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,16 @@ on:
44
pull_request:
55

66
jobs:
7-
lint-and-build:
8-
name: Lint, Type Check & Build
9-
runs-on: ubuntu-latest
10-
11-
steps:
12-
- name: Checkout
13-
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
14-
15-
- name: Setup Node
16-
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
17-
with:
18-
node-version-file: '.nvmrc'
19-
20-
- name: Enable corepack
21-
run: corepack enable
22-
23-
- name: Install dependencies
24-
run: yarn install --immutable
25-
26-
- name: Type check
27-
run: yarn typecheck
28-
29-
- name: Lint check
30-
run: yarn lint
31-
32-
- name: Build
33-
run: yarn prepare
7+
lint:
8+
name: Lint
9+
uses: ./.github/workflows/lint.yml
10+
11+
build-android:
12+
name: Build Android
13+
needs: lint
14+
uses: ./.github/workflows/build-android.yml
15+
16+
build-ios:
17+
name: Build iOS
18+
needs: lint
19+
uses: ./.github/workflows/build-ios.yml

.github/workflows/lint.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Lint
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
lint:
8+
name: Lint
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
14+
15+
- name: Setup Project
16+
uses: ./.github/actions/setup-node-yarn
17+
18+
- name: Type check
19+
run: yarn typecheck
20+
21+
- name: Lint check
22+
run: yarn lint

.github/workflows/release.yml

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,21 @@ jobs:
2626
with:
2727
fetch-depth: 0
2828

29-
- name: Setup Node
30-
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
31-
with:
32-
node-version-file: '.nvmrc'
29+
- name: Setup Project
30+
uses: ./.github/actions/setup-node-yarn
3331

34-
- name: Enable corepack
35-
run: corepack enable
32+
- name: Extract release notes from Unreleased section
33+
id: changelog
34+
run: |
35+
NOTES=$(awk '/## \[Unreleased\]/ {flag=1; next} /^## \[/ {flag=0} flag && NF {print}' CHANGELOG.md)
36+
if [ -z "$NOTES" ] || [ -z "$(echo "$NOTES" | tr -d '[:space:]')" ]; then
37+
echo "Error: No release notes found in the [Unreleased] section of CHANGELOG.md"
38+
echo "Please add release notes before creating a release."
39+
exit 1
40+
fi
41+
echo "notes<<EOF" >> $GITHUB_OUTPUT
42+
echo "$NOTES" >> $GITHUB_OUTPUT
43+
echo "EOF" >> $GITHUB_OUTPUT
3644
3745
- name: Bump version and update CHANGELOG
3846
id: bump
@@ -41,18 +49,18 @@ jobs:
4149
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
4250
sed -i "s/## \[Unreleased\]/## [Unreleased]\n\n## [$NEW_VERSION] - $(date +%Y-%m-%d)/" CHANGELOG.md
4351
44-
- name: Extract release notes
45-
id: changelog
52+
- name: Check if release already exists
4653
run: |
47-
NOTES=$(awk '/## \[Unreleased\]/ {flag=1; next} /^## \[/ {flag=0} flag {print}' CHANGELOG.md)
48-
echo "notes<<EOF" >> $GITHUB_OUTPUT
49-
echo "$NOTES" >> $GITHUB_OUTPUT
50-
echo "EOF" >> $GITHUB_OUTPUT
54+
if git ls-remote --tags origin | grep -q "refs/tags/${{ steps.bump.outputs.version }}$"; then
55+
echo "Error: Release tag ${{ steps.bump.outputs.version }} already exists"
56+
echo "Please check existing releases or use a different version bump type."
57+
exit 1
58+
fi
5159
5260
- name: Build and pack
5361
id: pack
5462
run: |
55-
yarn install
63+
yarn install --immutable
5664
yarn prepare
5765
yarn pack --filename mendix-native-${{ steps.bump.outputs.version }}.tgz
5866
echo "tgz=mendix-native-${{ steps.bump.outputs.version }}.tgz" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)