Skip to content

miyako/4d-template-component-cicd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A template repository for 4D component developement.

About

This repository is configured to enable CI/CD of 4D components using a chain of GitHub Actions.

You may clone it to get started with your own 4D component development on GitHub.

Note: If you rename the project, you should modify env.project_path in default.yml.

The build destination path is ${PWD}. See miyako/4D/.github/actions/build-component

env: 
  project_path: example/Project/example.4DProject

Development

Whenever you push changes to your main branch, the default workflow is automatically triggered in patch mode.

on:
  push:
    branches:
    - main
    paths:
      - '*/Project/Sources/**/*.4dm'
      - '*/Project/Sources/*/*.4DForm'
      - '*/Project/Sources/*.4DCatalog'
      - '*/Project/Resources/**'

Deployment

You can manually dispatch the default workflow for any branch, in either patch minor major mode.

Workflow

The workflow does the following:

  1. The project is compiled on a GitHub hosted runner (macos-latest) using tool4d.
  2. The project is built as a component for ARM/Apple Silicon and AMD/Intel processors.
  3. The component is signed with your Apple Developer ID Application certificate.
  4. The component is submitted to Apple for notarisation.
  5. The component is published under Releases (.zip and .dmg format).

Prerequisites

The repository must have package.json file at the root level.

Note: The format is obviously inspired by, but not necessarily relate to, npm. In future versions, 4D may roll out its own way of managing dependencies.

In addition to arbitrary meta properties, you should provide the following build parameters:

Path Type Description
version Text semantic versioning 2.0.0
tool.platform Text always macos
tool.branch Text default=20.x
tool.version Text default=20.2
tool.build Text default=latest
tool.arch Text always x86

Note: Free GitHub hosted macOS runners are running on Intel. If you have a subscription, you can select ARM hosted runners.

Your Apple Developer credentials should be stored in GitHub Actions secrets.

From Xcode or Keychain, export signing certificate. You will be asked to set a password.

Secret Description
APPLE_DEVELOPER_ID_CERTIFICATE base64 encoded
APPLE_DEVELOPER_ID_CERTIFICATE_PASSWORD password to read the certificate
KEYCHAIN_PASSWORD an arbitrary password (used to access temporary keychain)
NOTARYTOOL_APPLE_ID xcrun notarytool submit parameter
NOTARYTOOL_TEAM_ID xcrun notarytool submit parameter
NOTARYTOOL_PASSWORD xcrun notarytool submit parameter
CODESIGN_APPLE_ID codesignparameter

Reusable Workflow Actions

The following actions are used by the default workflow. If your repository is not allowed to execute external workflows, clone them.

In addition, the following GitHub workflow actions are used internally.

References

Installing an Apple certificate on macOS runners for Xcode development

c.f. https://localazy.com/blog/how-to-automatically-sign-macos-apps-using-github-actions