Skip to content

Commit 3390f77

Browse files
committed
(#107) Reorganize pipelines around type
Closes #107
1 parent ba77244 commit 3390f77

File tree

6 files changed

+134
-143
lines changed

6 files changed

+134
-143
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: "Modify Deployment Type"
2+
description: "Change the deployment type in the akumina.sitedeployer.config.json file"
3+
inputs:
4+
deployment_type:
5+
type: string
6+
# Documentation: https://akumina.github.io/docs/Site-Deployer-Version-6-0
7+
description: Akumina code deployment type
8+
required: true
9+
10+
runs:
11+
using: "composite"
12+
steps:
13+
14+
- name: Modify deployment type
15+
working-directory: site
16+
shell: pwsh
17+
run: |
18+
$deployment_type = $env:DEPLOYMENT_TYPE
19+
20+
# If no string is provided, assume "all" and set everything to false
21+
if ([string]::IsNullOrWhiteSpace($deployment_type)) {
22+
"You must provide a deployment type to proceed."
23+
exit 1
24+
}
25+
26+
# First, set all options to false in case a previous run messed with them
27+
jq '.Options |= with_entries(.value = false)' akumina.sitedeployer.config.json > tmpfile
28+
Move-Item -Path tmpfile -Destination akumina.sitedeployer.config.json -Force
29+
30+
# Split the input on commas and update the JSON file accordingly
31+
$deployment_types = $deployment_type -split ","
32+
foreach ($dt in $deployment_types) {
33+
jq --arg dt $dt '.Options[$dt] = true' akumina.sitedeployer.config.json > tmpfile
34+
Move-Item -Path tmpfile -Destination akumina.sitedeployer.config.json -Force
35+
}
36+
env:
37+
DEPLOYMENT_TYPE: ${{ inputs.deployment_type }}

.github/workflows/composite/setup/action.yml

+1-25
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
name: "Setup"
22
description: "Setup an Akumina deployment environment"
3-
inputs:
4-
deployment_type:
5-
type: string
6-
# Documentation: https://akumina.github.io/docs/Site-Deployer-Version-6-0
7-
description: Akumina code deployment type
8-
required: true
93

104
runs:
115
using: "composite"
@@ -43,22 +37,4 @@ runs:
4337
New-Item -ItemType Directory -Path $ExtractPath | Out-Null
4438
}
4539
Expand-Archive -Path "sd.zip" -DestinationPath $ExtractPath -Force
46-
Remove-Item -Path "sd.zip"
47-
48-
- name: Modify deployment type
49-
working-directory: site
50-
shell: pwsh
51-
run: |
52-
$deployment_type = $env:DEPLOYMENT_TYPE
53-
if ([string]::IsNullOrWhiteSpace($deployment_type)) {
54-
# If no string is provided, assume "all" and set everything to false
55-
"You must provide a deployment type to proceed."
56-
} else {
57-
# Split the string on commas and update the JSON file accordingly
58-
$deployment_types = $deployment_type -split ","
59-
foreach ($dt in $deployment_types) {
60-
jq --arg dt $dt '.Options[$dt] = true' akumina.sitedeployer.config.json > tmpfile ; Move-Item -Path tmpfile -Destination akumina.sitedeployer.config.json -Force
61-
}
62-
}
63-
env:
64-
DEPLOYMENT_TYPE: ${{ inputs.deployment_type }}
40+
Remove-Item -Path "sd.zip"

.github/workflows/deploy.yml

+94-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
name: Deploy Site
2+
run-name: Deploy Site - CDN${{ inputs.deploy-widgets && ', Widgets' || '' }}${{ inputs.deploy-lists && ', Lists' || '' }}
23
on:
34
workflow_dispatch:
5+
inputs:
6+
environment:
7+
type: environment
8+
deploy-widgets:
9+
description: Pack and deploy widgets
10+
type: boolean
11+
default: false
12+
deploy-lists:
13+
description: Deploy lists (TBD)
14+
type: boolean
15+
default: false
416

517
jobs:
618
deploy:
@@ -12,7 +24,88 @@ jobs:
1224
working-directory: site
1325

1426
steps:
27+
########## Preparation ##########
1528

1629
# Checkout the code
1730
- name: Checkout branch
18-
uses: actions/checkout@v3
31+
uses: actions/checkout@v3
32+
33+
# Sets up our deployment
34+
- uses: "./.github/workflows/composite/setup"
35+
36+
# Package the widgets (must run before build)
37+
- name: Package Widgets
38+
if: inputs.deploy-widgets
39+
# TO-DO: Implement tokenMap
40+
#run: npm run package ${{ inputs.widget_name }} -- --tokenMap ${{ inputs.token_map }}
41+
run: npm run package
42+
43+
# Runs webpack to copy the source to the build folder
44+
- name: Build
45+
run: npm run build${{ inputs.environment == 'Prod' && '-prod-ci' || ''}}
46+
47+
########## Deploy CDN Assets ##########
48+
49+
# Assumption is that we always want to update these because deploying widgets needs the widget views on the CDN.
50+
51+
# Set the deployment type
52+
- uses: "./.github/workflows/composite/deployment_type"
53+
with:
54+
deployment_type: "cdnassets"
55+
56+
# Runs akumina-widget-builder with the cdnpackage option to prep widgets for deployment
57+
- name: Package Widgets for CDN
58+
if: inputs.deploy-widgets
59+
run: npm run cdnpackage
60+
61+
# Runs site deployer
62+
- name: Deploy to CDN
63+
run: npm run deploy
64+
env:
65+
assetdirectory: Client
66+
azurestorageaccountkey: ${{ secrets.azure_storage_account_key }}
67+
azurestorageaccountname: ${{ vars.azure_storage_account_name }}
68+
azurestoragecontainer: ${{ vars.azure_storage_account_container }}
69+
spdirectory: DigitalWorkplace
70+
envdir: build
71+
72+
########## Deploy Widgets ##########
73+
74+
#run: npm run package ${{ inputs.widget_name }} -- --tokenMap ${{ inputs.token_map }}
75+
76+
# Set the deployment type
77+
- uses: "./.github/workflows/composite/deployment_type"
78+
if: inputs.deploy-widgets
79+
with:
80+
deployment_type: "widgets"
81+
82+
# Runs site deployer
83+
- name: Deploy Widgets
84+
if: inputs.deploy-widgets
85+
run: npm run deploy
86+
env:
87+
assetdirectory: Client
88+
clientid: ${{ secrets.client_id}}
89+
clientsecret: ${{ secrets.client_secret }}
90+
# Current assumption is that all widget instances are deployed to the Delivery site
91+
# If we ever go multi-site then we will have to reconsider if this is the correct mechanism
92+
spurl: ${{ vars.delivery_sp_url }}
93+
centralspurl: ${{ vars.central_sp_url }}
94+
spdirectory: DigitalWorkplace
95+
langid: 1033
96+
appmanagerurl: ${{ vars.appmanager_url }}
97+
akquerykey: ${{ secrets.ak_query_key }}
98+
ml: true
99+
envdir: build
100+
101+
########## Deploy Lists ##########
102+
103+
# TBD
104+
105+
########## Cleanup ##########
106+
107+
# Stores an artifact copy on the workflow run
108+
- name: Upload built artifact
109+
uses: actions/upload-artifact@v4
110+
with:
111+
path: site/build

.github/workflows/deploy_central.yml renamed to .github/workflows/deploy_central.yml.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
## Keeping for reference
2+
13
name: Deploy Central Site
24
on:
35
workflow_dispatch:

.github/workflows/deploy_delivery.yml

-66
This file was deleted.

.github/workflows/deploy_headless.yml

-51
This file was deleted.

0 commit comments

Comments
 (0)