Skip to content

Commit d4e7055

Browse files
Merge pull request #14 from mendix/release-automation
Automate release process
2 parents 190bfbc + 425f2b3 commit d4e7055

File tree

11 files changed

+375
-282
lines changed

11 files changed

+375
-282
lines changed

.github/actions/setup/action.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 17 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -1,154 +1,33 @@
11
name: CI
2+
23
on:
3-
push:
4-
branches:
5-
- main
64
pull_request:
7-
branches:
8-
- main
95

106
jobs:
11-
lint:
7+
lint-and-build:
8+
name: Lint, Type Check & Build
129
runs-on: ubuntu-latest
13-
steps:
14-
- name: Checkout
15-
uses: actions/checkout@v3
16-
17-
- name: Setup
18-
uses: ./.github/actions/setup
19-
20-
- name: Lint files
21-
run: yarn lint
2210

23-
- name: Typecheck files
24-
run: yarn typecheck
25-
26-
test:
27-
runs-on: ubuntu-latest
2811
steps:
2912
- name: Checkout
30-
uses: actions/checkout@v3
31-
32-
- name: Setup
33-
uses: ./.github/actions/setup
34-
35-
- name: Run unit tests
36-
run: yarn test --maxWorkers=2 --coverage
13+
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
3714

38-
build-library:
39-
runs-on: ubuntu-latest
40-
steps:
41-
- name: Checkout
42-
uses: actions/checkout@v3
43-
44-
- name: Setup
45-
uses: ./.github/actions/setup
46-
47-
- name: Build package
48-
run: yarn prepare
49-
50-
build-android:
51-
runs-on: ubuntu-latest
52-
env:
53-
TURBO_CACHE_DIR: .turbo/android
54-
steps:
55-
- name: Checkout
56-
uses: actions/checkout@v3
57-
58-
- name: Setup
59-
uses: ./.github/actions/setup
60-
61-
- name: Cache turborepo for Android
62-
uses: actions/cache@v3
63-
with:
64-
path: ${{ env.TURBO_CACHE_DIR }}
65-
key: ${{ runner.os }}-turborepo-android-${{ hashFiles('yarn.lock') }}
66-
restore-keys: |
67-
${{ runner.os }}-turborepo-android-
68-
69-
- name: Check turborepo cache for Android
70-
run: |
71-
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:android').cache.status")
72-
73-
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
74-
echo "turbo_cache_hit=1" >> $GITHUB_ENV
75-
fi
76-
77-
- name: Install JDK
78-
if: env.turbo_cache_hit != 1
79-
uses: actions/setup-java@v3
80-
with:
81-
distribution: 'zulu'
82-
java-version: '17'
83-
84-
- name: Finalize Android SDK
85-
if: env.turbo_cache_hit != 1
86-
run: |
87-
/bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null"
88-
89-
- name: Cache Gradle
90-
if: env.turbo_cache_hit != 1
91-
uses: actions/cache@v3
92-
with:
93-
path: |
94-
~/.gradle/wrapper
95-
~/.gradle/caches
96-
key: ${{ runner.os }}-gradle-${{ hashFiles('example/android/gradle/wrapper/gradle-wrapper.properties') }}
97-
restore-keys: |
98-
${{ runner.os }}-gradle-
99-
100-
- name: Build example for Android
101-
env:
102-
JAVA_OPTS: "-XX:MaxHeapSize=6g"
103-
run: |
104-
yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}"
105-
106-
build-ios:
107-
runs-on: macos-14
108-
env:
109-
TURBO_CACHE_DIR: .turbo/ios
110-
steps:
111-
- name: Checkout
112-
uses: actions/checkout@v3
113-
114-
- name: Setup
115-
uses: ./.github/actions/setup
116-
117-
- name: Cache turborepo for iOS
118-
uses: actions/cache@v3
15+
- name: Setup Node
16+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
11917
with:
120-
path: ${{ env.TURBO_CACHE_DIR }}
121-
key: ${{ runner.os }}-turborepo-ios-${{ hashFiles('yarn.lock') }}
122-
restore-keys: |
123-
${{ runner.os }}-turborepo-ios-
18+
node-version-file: '.nvmrc'
12419

125-
- name: Check turborepo cache for iOS
126-
run: |
127-
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:ios').cache.status")
20+
- name: Enable corepack
21+
run: corepack enable
12822

129-
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
130-
echo "turbo_cache_hit=1" >> $GITHUB_ENV
131-
fi
23+
- name: Install dependencies
24+
run: yarn install --immutable
13225

133-
- name: Cache cocoapods
134-
if: env.turbo_cache_hit != 1
135-
id: cocoapods-cache
136-
uses: actions/cache@v3
137-
with:
138-
path: |
139-
**/ios/Pods
140-
key: ${{ runner.os }}-cocoapods-${{ hashFiles('example/ios/Podfile.lock') }}
141-
restore-keys: |
142-
${{ runner.os }}-cocoapods-
26+
- name: Type check
27+
run: yarn typecheck
14328

144-
- name: Install cocoapods
145-
if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true'
146-
run: |
147-
cd example/ios
148-
pod install
149-
env:
150-
NO_FLIPPER: 1
29+
- name: Lint check
30+
run: yarn lint
15131

152-
- name: Build example for iOS
153-
run: |
154-
yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"
32+
- name: Build
33+
run: yarn prepare

.github/workflows/release.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "Version bump type"
8+
required: true
9+
type: choice
10+
options:
11+
- patch
12+
- minor
13+
- major
14+
15+
jobs:
16+
release:
17+
runs-on: ubuntu-latest
18+
19+
permissions:
20+
contents: write
21+
pull-requests: write
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Setup Node
30+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
31+
with:
32+
node-version-file: '.nvmrc'
33+
34+
- name: Enable corepack
35+
run: corepack enable
36+
37+
- name: Bump version and update CHANGELOG
38+
id: bump
39+
run: |
40+
NEW_VERSION=$(npm version ${{ github.event.inputs.version }} --no-git-tag-version)
41+
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
42+
sed -i "s/## \[Unreleased\]/## [Unreleased]\n\n## [$NEW_VERSION] - $(date +%Y-%m-%d)/" CHANGELOG.md
43+
44+
- name: Extract release notes
45+
id: changelog
46+
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
51+
52+
- name: Build and pack
53+
id: pack
54+
run: |
55+
yarn install
56+
yarn prepare
57+
yarn pack --filename mendix-native-${{ steps.bump.outputs.version }}.tgz
58+
echo "tgz=mendix-native-${{ steps.bump.outputs.version }}.tgz" >> $GITHUB_OUTPUT
59+
60+
- name: Create GitHub Release
61+
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b
62+
with:
63+
tag_name: ${{ steps.bump.outputs.version }}
64+
name: ${{ steps.bump.outputs.version }}
65+
body: ${{ steps.changelog.outputs.notes }}
66+
files: ${{ steps.pack.outputs.tgz }}
67+
68+
- name: Create Pull Request
69+
uses: peter-evans/create-pull-request@84ae59a2cdc2258d6fa0732dd66352dddae2a412
70+
with:
71+
commit-message: "chore: release ${{ steps.bump.outputs.version }}"
72+
branch: release/${{ steps.bump.outputs.version }}
73+
title: "Release ${{ steps.bump.outputs.version }}"
74+
body: "This PR updates CHANGELOG.md and package.json for release ${{ steps.bump.outputs.version }}."
75+
base: main

.github/workflows/secret-scan.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ node_modules/
5151
npm-debug.log
5252
yarn-debug.log
5353
yarn-error.log
54+
*.tgz
5455

5556
# BUCK
5657
buck-out/

.gitleaks.toml

Lines changed: 0 additions & 71 deletions
This file was deleted.

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v18
1+
24

0 commit comments

Comments
 (0)