@@ -3,112 +3,72 @@ name: "2. CD - Deploy"
33on :
44 workflow_dispatch :
55 inputs :
6- include_prereleases :
6+ source_type :
7+ description : " Deployment source type"
78 type : choice
8- description : " Include pre-releases "
9- default : " true "
9+ required : true
10+ default : release
1011 options :
11- - " true"
12- - " false"
13- version :
14- type : string
15- default : latest
16- description : " Install specific version"
12+ - release
13+ - branch
14+ source_value :
15+ description : " Release tag or branch name"
16+ type : string
17+ required : true
18+ deploy_backend :
19+ description : " Deploy backend infrastructure"
20+ type : boolean
21+ required : false
22+ default : true
23+ backend_account_group :
24+ description : " Target backend account group"
25+ type : choice
26+ required : true
27+ default : dev
28+ options :
29+ - dev
30+ - nonprod
31+ - prod
32+ deploy_proxy :
33+ description : " Deploy APIM proxy"
34+ type : boolean
35+ required : false
36+ default : true
37+ apim_environment :
38+ description : " Target APIM environment"
39+ type : choice
40+ required : true
41+ default : internal-dev
42+ options :
43+ - internal-dev
44+ - int
45+ - prod
46+ build_sandbox :
47+ description : " Build sandbox container"
48+ type : boolean
49+ required : false
50+ default : false
51+
52+ run-name : >-
53+ Deploy ${{ inputs.deploy_backend && format('backend={0}',
54+ inputs.backend_account_group) || '' }} ${{ inputs.deploy_proxy &&
55+ format('apim={0}', inputs.apim_environment) || '' }} source=${{
56+ inputs.source_type }}:${{ inputs.source_value }} by @${{ github.actor }}
1757
18- run-name : " Include prerelease: ${{ inputs.include_prereleases }} Version: ${{ inputs.version }} by @${{ github.actor }}"
1958permissions :
20- contents : read
21- pages : write
2259 id-token : write
60+ contents : read
61+ packages : read
2362
2463jobs :
25- metadata :
26- name : " Set CI/CD metadata"
27- runs-on : ubuntu-latest
28- timeout-minutes : 1
29- outputs :
30- build_datetime : ${{ steps.variables.outputs.build_datetime }}
31- build_timestamp : ${{ steps.variables.outputs.build_timestamp }}
32- build_epoch : ${{ steps.variables.outputs.build_epoch }}
33- nodejs_version : ${{ steps.variables.outputs.nodejs_version }}
34- python_version : ${{ steps.variables.outputs.python_version }}
35- terraform_version : ${{ steps.variables.outputs.terraform_version }}
36- version : ${{ steps.variables.outputs.version }}
37- # tag: ${{ steps.variables.outputs.tag }}
38- steps :
39- - name : " Checkout code"
40- uses : actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
41- - name : " Set CI/CD variables"
42- id : variables
43- run : |
44- datetime=$(date -u +'%Y-%m-%dT%H:%M:%S%z')
45- echo "build_datetime=$datetime" >> $GITHUB_OUTPUT
46- echo "build_timestamp=$(date --date=$datetime -u +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
47- echo "build_epoch=$(date --date=$datetime -u +'%s')" >> $GITHUB_OUTPUT
48- echo "nodejs_version=$(grep "^nodejs\s" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
49- echo "python_version=$(grep "^python\s" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
50- echo "terraform_version=$(grep "^terraform\s" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
51- echo "version=$(head -n 1 .version 2> /dev/null || echo unknown)" >> $GITHUB_OUTPUT
52- # echo "tag=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
53- - name : " List variables"
54- run : |
55- export BUILD_DATETIME="${{ steps.variables.outputs.build_datetime }}"
56- export BUILD_TIMESTAMP="${{ steps.variables.outputs.build_timestamp }}"
57- export BUILD_EPOCH="${{ steps.variables.outputs.build_epoch }}"
58- export NODEJS_VERSION="${{ steps.variables.outputs.nodejs_version }}"
59- export PYTHON_VERSION="${{ steps.variables.outputs.python_version }}"
60- export TERRAFORM_VERSION="${{ steps.variables.outputs.terraform_version }}"
61- export VERSION="${{ steps.variables.outputs.version }}"
62- # export TAG="${{ steps.variables.outputs.tag }}"
63- make list-variables
64-
65- deploy-jekyll :
66- environment :
67- name : github-pages
68- url : ${{ steps.deployment.outputs.page_url }}
69- runs-on : ubuntu-latest
70- needs : metadata
71- steps :
72- - name : " Checkout code"
73- uses : actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
74- - name : " Get version"
75- id : get-asset-version
76- shell : bash
77- env :
78- GH_TOKEN : ${{ github.token }}
79- run : |
80- if [[ ${{inputs.include_prereleases}} == true ]]; then
81- json=$(gh release list --json tagName --limit 1 --exclude-drafts)
82- else
83- json=$(gh release list --json tagName --limit 1 --exclude-drafts --exclude-pre-releases)
84- fi
85-
86- echo $json
87-
88- release_version=$(echo $json | (jq -r '.[0].tagName'))
89- if [[ $release_version == null ]]; then exit 1; else echo $release_version; fi
90-
91- if [[ ${{inputs.version}} == latest ]]; then
92- echo release_version=$(echo $release_version) >> $GITHUB_OUTPUT
93- else
94- echo release_version=$(echo ${{inputs.version}}) >> $GITHUB_OUTPUT
95- fi
96-
97- - name : " Get release version"
98- id : download-asset
99- shell : bash
100- env :
101- GH_TOKEN : ${{ github.token }}
102- run : |
103- gh release download ${{steps.get-asset-version.outputs.release_version}} -p jekyll-docs-*.tar --output artifact.tar
104-
105- - uses : actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
106- with :
107- name : jekyll-docs-${{steps.get-asset-version.outputs.release_version}}
108- path : artifact.tar
109-
110- - name : Deploy to GitHub Pages
111- id : deployment
112- uses : actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4
113- with :
114- artifact_name : jekyll-docs-${{steps.get-asset-version.outputs.release_version}}
64+ deploy :
65+ uses : ./.github/workflows/deploy-supplier-api.yaml
66+ secrets : inherit
67+ with :
68+ backend_account_group : ${{ inputs.backend_account_group }}
69+ apim_environment : ${{ inputs.apim_environment }}
70+ source_type : ${{ inputs.source_type }}
71+ source_value : ${{ inputs.source_value }}
72+ deploy_backend : ${{ inputs.deploy_backend }}
73+ deploy_proxy : ${{ inputs.deploy_proxy }}
74+ build_sandbox : ${{ inputs.build_sandbox }}
0 commit comments