Update build.yaml #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Nuxt and Cordova | |
on: | |
push: | |
branches: | |
- beta # Adjust to your main branch | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the repository | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Step 2: Set up Node.js | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' # Adjust to your Node.js version | |
# Step 3: Install dependencies for Nuxt 3 project | |
- name: Install dependencies | |
run: npm install | |
working-directory: . # Root directory | |
# Step 4: Build the Nuxt 3 app | |
- name: Build Nuxt 3 app | |
run: npm run generate | |
working-directory: . # Root directory | |
# Step 5: Copy Nuxt build output to Cordova 'www' folder | |
- name: Copy Nuxt build to Cordova www | |
run: | | |
rm -rf mobile/www/* | |
cp -r dist/* mobile/www/ | |
working-directory: . | |
# Step 6: Set up Java (required for Cordova) | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' # Adjust this to your required Java version | |
distribution: 'adopt' | |
# Step 7: Set up Android SDK (using android-actions/setup-android) | |
- name: Install Android SDK | |
uses: android-actions/setup-android@v2 | |
with: | |
api-level: 30 # Adjust to your preferred Android API level | |
ndk: '21.4.7075529' # Adjust NDK version if needed | |
# Step 8: Install Cordova | |
- name: Install Cordova | |
run: npm install -g cordova | |
# Step 9: Build the Cordova Android app | |
- name: Build Cordova Android app | |
run: | | |
cordova platform add android | |
cordova build android | |
working-directory: mobile | |
# Step 10: Upload the APK as an artifact | |
- name: Upload APK | |
uses: actions/upload-artifact@v4 | |
with: | |
name: app-release.apk | |
path: mobile/platforms/android/app/build/outputs/apk/debug/app-debug.apk # Adjust if using release build |