Skip to content

Commit 083caf7

Browse files
committed
Add CI/CD pipelines for automated deployment to Azure Blob Storage
## Summary Adds two GitHub Actions workflows to automate deployments of the pathways editor to Azure Blob Storage, mirroring the deployment setup used in the workspaces frontend repo. ### New workflows **`deploy-to-blob.yml` — Release to Azure Blob Storage** - Runs manually via `workflow_dispatch` (choose environment: `develop`, `staging`, `production`) or from another workflow via `workflow_call` - Checks out the selected environment branch, builds the editor with Node 20 (`npm clean-install` + `npm run all`), and uploads the built `dist/` to the `pathways-editor` container - Maps environments to destination folders: `develop` → `dev`, `staging` → `stage`, `production` → `prod` **`deploy-on-merge.yml` — Trigger deployment on PR merge** - Fires when a PR is merged into `develop`, `staging`, or `production` - Calls the release workflow with the merged branch as the target environment
1 parent 077da02 commit 083caf7

2 files changed

Lines changed: 105 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Triggers Deployment on Pull Request Merge
2+
on:
3+
pull_request:
4+
types: [closed]
5+
branches: [develop, staging, production]
6+
jobs:
7+
on-merge:
8+
if: github.event.pull_request.merged == true
9+
runs-on: ubuntu-latest
10+
outputs:
11+
target_branch: ${{ steps.get_branch.outputs.branch_name }}
12+
steps:
13+
- name: Get the target branch
14+
id: get_branch
15+
run: echo "branch_name=${{ github.base_ref }}" >> $GITHUB_OUTPUT
16+
17+
trigger-deploy-workflow:
18+
needs: on-merge
19+
uses: ./.github/workflows/deploy-to-blob.yml
20+
with:
21+
environment: ${{ needs.on-merge.outputs.target_branch }}
22+
version: 'latest'
23+
secrets: inherit
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Release to Azure Blob Storage
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
environment:
6+
description: 'Environment to deploy to'
7+
required: true
8+
default: 'develop'
9+
type: choice
10+
options:
11+
- develop
12+
- staging
13+
- production
14+
version:
15+
description: 'Version to deploy'
16+
required: true
17+
default: 'latest'
18+
workflow_call:
19+
inputs:
20+
environment:
21+
description: 'Environment to deploy to'
22+
required: true
23+
default: 'develop'
24+
type: string
25+
version:
26+
description: 'Version to deploy'
27+
required: true
28+
default: 'latest'
29+
type: string
30+
jobs:
31+
deploy:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Checkout code
35+
uses: actions/checkout@v4
36+
with:
37+
ref: ${{ inputs.environment }}
38+
39+
- name: Set up Node.js
40+
uses: actions/setup-node@v4
41+
with:
42+
node-version: '20'
43+
44+
# Infer the environment from the workflow input and set the appropriate environment variable
45+
- name: Set the target container
46+
run: |
47+
if [ "${{ inputs.environment }}" == "develop" ]; then
48+
echo "TARGET_CONTAINER=dev" >> $GITHUB_ENV
49+
elif [ "${{ inputs.environment }}" == "staging" ]; then
50+
echo "TARGET_CONTAINER=stage" >> $GITHUB_ENV
51+
elif [ "${{ inputs.environment }}" == "production" ]; then
52+
echo "TARGET_CONTAINER=prod" >> $GITHUB_ENV
53+
else
54+
echo "Invalid environment specified"
55+
exit 1
56+
fi
57+
58+
- name: Install dependencies
59+
run: npm clean-install
60+
env:
61+
FORCE_COLOR: 2
62+
63+
- name: Build
64+
run: npm run all
65+
env:
66+
FORCE_COLOR: 2
67+
68+
- name: Gather build artifacts
69+
run: |
70+
mkdir -p build
71+
cp -r dist/* build/
72+
echo "Files in build directory:"
73+
ls -R build
74+
75+
- name: Upload to Azure Blob Storage
76+
uses: LanceMcCarthy/Action-AzureBlobUpload@v3
77+
with:
78+
source_folder: 'build'
79+
connection_string: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}
80+
container_name: 'pathways-editor'
81+
destination_folder: '${{ env.TARGET_CONTAINER }}'
82+
delete_if_exists: true

0 commit comments

Comments
 (0)