We added a new tutorial for configuring continuous delivery workflows for Forge apps:
Set up continuous delivery for Forge apps
This tutorial focuses on the use of environment variables for builds. It includes steps you can use to build a functional Bitbucket Cloud pipeline, along with general guidelines for GitHub users.
We published this tutorial as a response to community requests for better documentation of Forge CI/CD support .
5 Likes
Here is what we did for GitHub:
name: Build, Lint, Test and Deploy
on:
push:
pull_request:
branches:
- main
types: [opened, synchronize, reopened]
workflow_dispatch:
jobs:
build:
name: Build, List, Test and Deploy backend & frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Verify backend
shell: bash -l {0}
run: |
nvm install
npm run server:install
npm run server:lint
npm run server:test
- name: Verify frontend
shell: bash -l {0}
run: |
npm run client:install
npm run client:lint
npm run client:test
# Only run this step if we push to the main branch
- name: Update manifest app id
if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') }}
run: |
cd scripts
npm install
node ./updateManifest.js
# Only run this step if we push to a branch
- name: Deploy to Atlassian cloud site
if: ${{ (github.event_name == 'push')}}
run: |
npm install @forge/cli@latest --no-optional
npm run client:build
npx forge settings set usage-analytics false
branch=${{ github.ref }}
if [ $branch == "refs/heads/dev" ]
then
npx forge login --email ${FORGE_DEV_EMAIL} --token ${FORGE_DEV_TOKEN} --non-interactive
npx forge variables set LICENSE_OVERRIDE active -e development
npx forge deploy -e development
elif [ $branch == "refs/heads/stage" ]
then
npx forge login --email ${FORGE_STAGE_EMAIL} --token ${FORGE_STAGE_TOKEN} --non-interactive
npx forge variables set LICENSE_OVERRIDE active -e staging
npx forge deploy -e staging
elif [ $branch == "refs/heads/main" ]
then
npx forge login --email ${FORGE_EMAIL} --token ${FORGE_TOKEN} --non-interactive
npx forge deploy -e production
fi
env:
FORGE_DEV_EMAIL: ${{ secrets.FORGE_DEV_EMAIL }}
FORGE_DEV_TOKEN: ${{ secrets.FORGE_DEV_TOKEN }}
FORGE_STAGE_TOKEN: ${{ secrets.FORGE_STAGE_TOKEN }}
FORGE_STAGE_EMAIL: ${{ secrets.FORGE_STAGE_EMAIL }}
FORGE_TOKEN: ${{ secrets.FORGE_TOKEN }}
FORGE_EMAIL: ${{ secrets.FORGE_EMAIL }}
sonarcloud:
name: SonarCloud
if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'pull_request' && github.base_ref == 'main') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@v1.6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
2 Likes
Thanks for sharing this @BorisBerenberg , I’ve been looking forward to seeing a working GitHub workflow!
system
Closed
December 21, 2022, 11:22pm
4
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.