# Forge CLI .gitlab-ci.yaml

**URL:** <https://community.developer.atlassian.com/t/forge-cli-gitlab-ci-yaml/99918>\
**Category:** Forge Platform and Tools\
**Tags:** cicd, forge-cli, forge-cli-cicd, forge\
**Created:** [March 29, 2026, 4:21am UTC](https://community.developer.atlassian.com/t/forge-cli-gitlab-ci-yaml/99918 "2026-03-29T04:21:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AndrewTyson](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/andrewtyson/32/52861_2.png) [@AndrewTyson](https://community.developer.atlassian.com/u/AndrewTyson)\
**Post date:** [March 29, 2026, 4:21am UTC](https://community.developer.atlassian.com/t/forge-cli-gitlab-ci-yaml/99918/1 "2026-03-29T04:21:57Z")

</div>

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!

```auto
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

---

<div class="post-metadata">

**Author:** ![DylanKroft](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/dylankroft/32/53779_2.png) [@DylanKroft](https://community.developer.atlassian.com/u/DylanKroft)\
**Post date:** [March 30, 2026, 12:34am UTC](https://community.developer.atlassian.com/t/forge-cli-gitlab-ci-yaml/99918/2 "2026-03-30T00:34:55Z")

</div>

Hey @AndrewTyson,

Thanks for sharing this–it’s awesome to see Forge Devcontainers in use.

Just a question, how are you using the env var `FORGE_CLI_VERSION` to pin the version?

---

<div class="post-metadata">

**Author:** ![AndrewTyson](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/andrewtyson/32/52861_2.png) [@AndrewTyson](https://community.developer.atlassian.com/u/AndrewTyson)\
**Post date:** [March 30, 2026, 10:01am UTC](https://community.developer.atlassian.com/t/forge-cli-gitlab-ci-yaml/99918/3 "2026-03-30T10:01:33Z")

</div>

Thanks @DylanKroft - good spotting … that variable is redundant, given that it uses the `atlassian/forge-devcontainer` image.

Cheers
