Skip to content

Commit 301d84a

Browse files
committed
Add Capacitor support and update dependencies, bump to v2
1 parent 9d9967f commit 301d84a

File tree

12 files changed

+5531
-10902
lines changed

12 files changed

+5531
-10902
lines changed

.eslintrc.json renamed to .eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{
1+
{
22
"plugins": ["jest", "@typescript-eslint"],
33
"extends": ["plugin:github/recommended"],
44
"parser": "@typescript-eslint/parser",

.github/workflows/ci.yml

Lines changed: 85 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,94 @@
11
name: "CI"
2-
on: # rebuild any PRs and main branch changes
2+
on:
33
pull_request:
44
push:
55
branches:
66
- master
77

88
jobs:
9-
build: # make sure build/ci work properly
10-
runs-on: ubuntu-latest
9+
build:
10+
name: Build and test
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ubuntu-latest, macos-latest, windows-latest]
16+
node: [20]
1117
steps:
12-
- uses: actions/checkout@v5
13-
- run: |
14-
npm ci
15-
npm run all
16-
test: # make sure the action works on a clean machine without building
17-
runs-on: ubuntu-latest
18+
- uses: actions/checkout@v5
19+
- uses: actions/setup-node@v6
20+
with:
21+
node-version: ${{ matrix.node }}
22+
- run: npm ci
23+
- run: npm run all
24+
25+
# merged into integration jobs below
26+
27+
test-cordova:
28+
name: Test (Cordova) on Ubuntu/macOS; iOS on macOS
29+
runs-on: ${{ matrix.os }}
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
os: [ubuntu-latest, macos-latest, windows-latest]
34+
steps:
35+
- uses: actions/checkout@v5
36+
- uses: actions/setup-node@v6
37+
with:
38+
node-version: 20
39+
- name: Setup environment
40+
uses: ./
41+
with:
42+
legacy: true
43+
install-pods: ${{ matrix.os == 'macos-latest' }}
44+
- name: Verify CLI
45+
run: |
46+
cordova -v
47+
ionic info || true
48+
- name: Build Android sample
49+
run: |
50+
ionic start testapp blank --cordova --type angular --no-link --no-git --no-interactive --confirm
51+
cd testapp
52+
ionic cordova platform add android@latest
53+
ionic cordova build android
54+
- name: Build iOS sample (macOS only)
55+
if: ${{ matrix.os == 'macos-latest' }}
56+
run: |
57+
cd testapp
58+
ionic cordova platform add ios@latest
59+
ionic cordova build ios --no-interactive -- --buildFlag="-sdk iphonesimulator"
60+
61+
test-capacitor:
62+
name: Test (Capacitor) on Ubuntu/macOS; iOS on macOS
63+
runs-on: ${{ matrix.os }}
64+
strategy:
65+
fail-fast: false
66+
matrix:
67+
os: [ubuntu-latest, macos-latest, windows-latest]
1868
steps:
19-
- uses: actions/checkout@v5
20-
- uses: actions/setup-java@v5
21-
with:
22-
distribution: 'adopt' # See 'Supported distributions' for available options
23-
java-version: 8
24-
- name: Use coturiv/setup-ionic
25-
uses: ./
26-
- name: Run cordova project tests
27-
run: |
28-
ionic start testapp blank --cordova --type angular --no-link --no-git --no-interactive --confirm
29-
cd testapp
30-
ionic cordova platform add android@latest
31-
ionic cordova build android
69+
- uses: actions/checkout@v5
70+
- uses: actions/setup-node@v6
71+
with:
72+
node-version: 20
73+
- name: Setup environment
74+
uses: ./
75+
with:
76+
legacy: false
77+
install-pods: ${{ matrix.os == 'macos-latest' }}
78+
- name: Verify CLI
79+
run: |
80+
cap --version
81+
ionic info || true
82+
- name: Build Android sample
83+
run: |
84+
ionic start testapp blank --type angular --no-link --no-git --no-interactive --confirm
85+
cd testapp
86+
ionic cap add android
87+
ionic cap build android
88+
- name: Build iOS sample (macOS only)
89+
if: ${{ matrix.os == 'macos-latest' }}
90+
run: |
91+
cd testapp
92+
ionic cap add ios
93+
npx cap sync ios
94+
xcodebuild -workspace ios/App/App.xcworkspace -scheme App -sdk iphonesimulator -configuration Debug build

.prettierrc.json renamed to .prettierrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
"bracketSpacing": false,
99
"arrowParens": "avoid",
1010
"parser": "typescript"
11-
}
11+
}

README.md

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,47 @@
22

33
[![](https://github.com/coturiv/setup-ionic/workflows/CI/badge.svg)](https://github.com/coturiv/setup-ionic/actions)
44

5-
Set up your GitHub Actions workflow with Cordova/Ionic environment. Only supports macos & ubuntu at this time.
5+
Set up your GitHub Actions workflow with Capacitor or Cordova environment. Supports macOS, Ubuntu, and Windows.
66

7-
## example usage:
7+
## example usage
88

99
```
10-
- name: Use coturiv/setup-ionic
11-
uses: coturiv/setup-ionic@v1
10+
# Capacitor (default)
11+
- name: Setup environment
12+
uses: coturiv/setup-ionic@v2
1213
with:
13-
java-version: 8
14-
- name: Use coturiv/setup-ionic
15-
uses: coturiv/setup-ionic@v1
14+
legacy: false
15+
capacitor-version: latest
16+
java-version: 17
17+
18+
- name: Build Android
19+
run: |
20+
npx cap sync android
21+
cd android
22+
./gradlew assembleDebug
23+
24+
- name: Build iOS (macOS only)
25+
run: |
26+
npx cap sync ios
27+
xcodebuild -workspace ios/App/App.xcworkspace -scheme App -sdk iphonesimulator -configuration Debug build
28+
29+
# Cordova (legacy)
30+
- name: Setup environment
31+
uses: coturiv/setup-ionic@v2
1632
with:
17-
cordova-version: 8
33+
legacy: true
34+
cordova-version: 10
35+
java-version: 17
1836
19-
- name: Build
37+
- name: Build Android
2038
run: |
2139
ionic cordova build android --prod
22-
2340
```
2441

25-
### important*
26-
27-
_From Ubuntu 20.04 runners, the default version of Java is 11, so you need to specify it to 8(1.8), due to the requirement of cordova, but will be removed in future releases. See [here](), and [here](https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html#java-development-kit-jdk)_
42+
### caching
2843

29-
```
30-
- name: Set up JDK 1.8
31-
uses: actions/setup-java@v1
32-
with:
33-
java-version: 1.8
34-
```
44+
- Automatically restores/saves caches for:
45+
- `node_modules` keyed by lockfile
46+
- Gradle caches and wrapper
47+
- CocoaPods caches (macOS) and `ios/Pods`
48+
- Android SDK directory keyed by installed platforms/build-tools

action.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'Setup Ionic'
2-
description: 'Set up your GitHub Actions workflow with Cordova/Ionic environment. Only supports macos & ubuntu at this time.'
2+
description: 'Set up your GitHub Actions workflow with Capacitor or Cordova environment.'
33
author: 'coturiv'
44
branding:
55
color: purple
@@ -8,9 +8,17 @@ branding:
88
inputs:
99
cordova-version:
1010
description: Version range or exact version of Cordova to use
11-
default: '10'
1211
ionic-version:
1312
description: Version range or exact version of Ionic to use
13+
capacitor-version:
14+
description: Version range or exact version of Capacitor CLI to use
15+
default: 'latest'
16+
legacy:
17+
description: Use Cordova (true) or Capacitor (false)
18+
default: 'false'
19+
java-version:
20+
description: JDK major version to install on Linux/macOS (e.g. 17, 21)
21+
default: '17'
1422
install-java:
1523
description: Whether to install Java
1624
default: true
@@ -19,5 +27,5 @@ inputs:
1927
default: true
2028

2129
runs:
22-
using: 'node12'
30+
using: 'node20'
2331
main: 'dist/index.js'

0 commit comments

Comments
 (0)