1
1
name : Deployment Setup
2
2
on :
3
3
workflow_call :
4
+ inputs :
5
+ type :
6
+ type : string
7
+ required : false
8
+ default : release
9
+ description : The type of deployment - either 'release' or 'prerelease'
10
+ version :
11
+ type : string
12
+ required : true
13
+ description : The version of the model being deployed
4
14
jobs :
5
15
setup-spack-env :
6
16
name : Setup Spack Environment
@@ -15,22 +25,31 @@ jobs:
15
25
run : echo "model=$(echo ${{ github.event.repository.name }} | tr [:upper:] [:lower:])" >> $GITHUB_OUTPUT
16
26
- name : Set Spack Env Name String
17
27
id : get-env-name
18
- # replace occurences of '.' with '_' in environment name as spack doesn't support '.'. Ex: 'access-om2-v1.0.0' -> 'access-om2-v1_0_0'.
19
- run : echo "env-name=$(echo '${{ steps.get-model.outputs.model }}-${{ github.ref_name }}' | tr '.' '_')" >> $GITHUB_OUTPUT
20
-
28
+ # replace occurences of '.' with '_' in environment name as spack doesn't support '.'. Ex: 'access-om2-v1.0.0' -> 'access-om2-v1_0_0'.
29
+ run : echo "env-name=$(echo '${{ steps.get-model.outputs.model }}-${{ inputs.version }}' | tr '.' '_')" >> $GITHUB_OUTPUT
30
+
21
31
setup-deployment-env :
22
32
name : Setup Deployment Environment
23
33
runs-on : ubuntu-latest
24
34
outputs :
25
35
deployment-environments : ${{ steps.get-deployment-environment.outputs.deployment-environments }}
26
36
steps :
27
- - name : Checkout config
37
+ - name : Checkout Config
28
38
uses : actions/checkout@v4
29
39
with :
30
40
repository : access-nri/build-cd
31
- - name : Get environments
41
+
42
+ - name : Get Environments
32
43
id : get-deployment-environment
33
- run : echo "deployment-environments=$(jq --compact-output '.environments' ./config/deployment-environment.json)" >> $GITHUB_OUTPUT
44
+ run : |
45
+ if [[ "${{ inputs.type }}" == "release" ]]; then
46
+ echo "deployment-environments=$(jq --compact-output '.environments' ./config/deployment-environment.json)" >> $GITHUB_OUTPUT
47
+ else if [[ "${{ inputs.type }}" == "prerelease" ]]; then
48
+ echo "deployment-environments=$(jq --compact-output '.prerelease-environments' ./config/deployment-environment.json)" >> $GITHUB_OUTPUT
49
+ else
50
+ echo "::error::The 'type' input was invalid. Check the inputs documentation."
51
+ exit 1
52
+ fi
34
53
35
54
deployment :
36
55
name : Deployment
43
62
deployment-environment : ${{ fromJson(needs.setup-deployment-env.outputs.deployment-environments) }}
44
63
uses : access-nri/build-cd/.github/workflows/deploy-2-start.yml@main
45
64
with :
65
+ type : ${{ inputs.type }}
46
66
model : ${{ needs.setup-spack-env.outputs.model }}
47
- version : ${{ github.ref_name }}
67
+ version : ${{ inputs.version }}
48
68
env-name : ${{ needs.setup-spack-env.outputs.env-name }}
49
69
deployment-environment : ${{ matrix.deployment-environment }}
50
70
secrets : inherit
0 commit comments