Hi All,
I have a working Gitlab .gitlab-ci.yml that builds a Forge Marketplace application and deploys to: development, staging or production environment based upon the branch. The application has two React applications, one primary and one for a modal full screen view.
Enjoy!
stages:
- build
- deploy
variables:
# Pin the CLI major version to avoid breaking changes in future major versions
FORGE_CLI_VERSION: "12"
VP4C_PATH: "${CI_PROJECT_DIR}/static/vp4c"
VP4C_MODAL_PATH: "${CI_PROJECT_DIR}/static/vp4c-modal"
build_vpc:
stage: build
image: node:20
before_script:
- cd ${VP4C_PATH}
- echo "Installing dependencies in ${PWD}"
- npm install --legacy-peer-deps
script:
- cd ${VP4C_PATH}
- echo "Building in ${PWD}"
- npm run build
artifacts:
untracked: false
when: on_success
access: all
expire_in: 30 days
paths:
- ${VP4C_PATH}/build
build_vp4c_modal:
stage: build
image: node:20
before_script:
- cd ${VP4C_MODAL_PATH}
- echo "Installing dependencies in ${PWD}"
- npm install --legacy-peer-deps
script:
- cd ${VP4C_MODAL_PATH}
- echo "Building in ${PWD}"
- npm run build
artifacts:
untracked: false
when: on_success
access: all
expire_in: 30 days
paths:
- ${VP4C_MODAL_PATH}/build
.node-template:
stage: deploy
image: atlassian/forge-devcontainer
before_script:
- cd ${CI_PROJECT_DIR}
- echo "Installing dependencies in ${PWD}"
- npm install --legacy-peer-deps
dependencies:
- build_vpc
- build_vp4c_modal
deploy_development_job:
extends: .node-template
only:
- development
script:
- forge settings set usage-analytics false
- forge deploy -e development --non-interactive
deploy_staging_job:
extends: .node-template
only:
- staging
script:
- forge settings set usage-analytics false
- forge deploy -e staging --non-interactive
deploy_production_job:
extends: .node-template
only:
- production
script:
- forge settings set usage-analytics false
- forge deploy -e production --non-interactive
Cheers,
Andrew