remove container: cibuilds/github:latest #5
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
# Template configuration for Convertigo project CI build on GitHub Actions | |
# Please consult the GitHub documentation for details about settings | |
# https://docs.github.com/en/actions | |
# | |
# This sample assumes you have declared the following Encrypted Secrets | |
# https://docs.github.com/en/actions/reference/encrypted-secrets | |
# | |
# C8O_SERVER: Convertigo server endpoint, where the built mobile application will connect | |
# and the backend project will be deployed, like https://<myhost>/convertigo | |
# C8O_USER: Convertigo server admin or a user with role PROJECTS_CONFIG, used for the deploiment | |
# C8O_PASSWORD: Convertigo server password for the C8O_USER | |
# | |
# Discover all tasks and -Pconvertigo options in your project build.gradle file. | |
name: Convertigo CI | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the master branch | |
on: | |
push: | |
branches: | |
- beta | |
tags: | |
- '**' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: ${{ github.ref_name == 'beta' && 'beta' || 'demo' }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ssh-key: ${{ secrets.SSH_KEY }} | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Cache Gradle Dependencies | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-caches-v1-${{ hashFiles('**/*.gradle', '**/gradle/wrapper/gradle-wrapper.properties') }} | |
restore-keys: ${{ runner.os }}-gradle-caches-v1- | |
- name: Convertigo generate application code | |
env: | |
C8O_SERVER: ${{ secrets.C8O_SERVER }} | |
run: | | |
echo "Generate Mobile Builder App" && \ | |
sh gradlew --stacktrace --info generateMobileBuilder export -x compileMobileBuilder \ | |
-Pconvertigo.load.mobileApplicationEndpoint=$C8O_SERVER | |
- name: Cache Node Modules | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ github.workspace }}/_private/ionic/node_modules | |
${{ github.workspace }}/_private/ionic/.angular | |
/home/runner/convertigo/nodes | |
key: ${{ runner.os }}-build-node-${{ hashFiles('**/package.json', '**/_private/ionic/version.json') }} | |
restore-keys: ${{ runner.os }}-build-node- | |
- name: Convertigo build, deploy to server and export the application | |
env: | |
C8O_SERVER: ${{ secrets.C8O_SERVER }} | |
C8O_USER: ${{ secrets.C8O_USER }} | |
C8O_PASSWORD: ${{ secrets.C8O_PASSWORD }} | |
run: | | |
echo "Build, deploy to $C8O_SERVER and export to project.zip the application" && \ | |
sh gradlew --stacktrace --info car deploy launchRemoteBuild -x generateMobileBuilder \ | |
-Pconvertigo.deploy.server=$C8O_SERVER \ | |
-Pconvertigo.deploy.user=$C8O_USER \ | |
-Pconvertigo.deploy.password=$C8O_PASSWORD | |
- name: Save application project | |
uses: actions/upload-artifact@v4 | |
with: | |
name: project | |
path: build/*.car | |
release: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download CAR File | |
uses: actions/download-artifact@v4 | |
with: | |
name: project | |
- name: Deploy to GitHub Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: '*.car' | |
tag_name: ${{ github.ref_name }} | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |