Skip to content

Commit e748c54

Browse files
minor improvements to deploy
1 parent d786128 commit e748c54

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

.github/workflows/deploy-supplier-api.yaml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ jobs:
7474
7575
# --- Shared source validation ---
7676
77+
if [[ "$deploy_backend" != "true" && "$deploy_proxy" != "true" ]]; then
78+
echo "[ERROR] At least one of deploy_backend or deploy_proxy must be true."
79+
exit 1
80+
fi
81+
7782
if [[ -z "$source_value" ]]; then
7883
echo "[ERROR] source_value cannot be empty."
7984
exit 1
@@ -87,7 +92,7 @@ jobs:
8792
echo "[ERROR] Release tags must be semantic versions, for example v1.2.3."
8893
exit 1
8994
fi
90-
gh release view "$source_value" --repo "$GITHUB_REPOSITORY" >/dev/null
95+
release_json=$(gh release view "$source_value" --repo "$GITHUB_REPOSITORY" --json assets)
9196
is_release="true"
9297
elif [[ "$source_type" == "branch" ]]; then
9398
branch_matches=$(gh api "repos/${GITHUB_REPOSITORY}/git/matching-refs/heads/${source_value}" --jq 'length')
@@ -143,8 +148,7 @@ jobs:
143148
144149
if [[ "$is_release" == "true" ]]; then
145150
oas_asset="api-oas-specification-${apim_environment}-${source_value}.zip"
146-
gh release view "$source_value" --repo "$GITHUB_REPOSITORY" --json assets \
147-
--jq '.assets[].name' | grep -x "$oas_asset" >/dev/null
151+
echo "$release_json" | jq -r '.assets[].name' | grep -x "$oas_asset" >/dev/null
148152
fi
149153
fi
150154
@@ -180,7 +184,7 @@ jobs:
180184
needs: validate
181185
steps:
182186
- name: Checkout repository
183-
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
187+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
184188

185189
- name: Deploy backend environment
186190
env:
@@ -203,7 +207,12 @@ jobs:
203207
needs: [ validate, deploy-backend ]
204208
steps:
205209
- name: Checkout repository
206-
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
210+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
211+
212+
- name: Resolve nodejs version
213+
id: toolversions
214+
run: echo "nodejs_version=$(grep '^nodejs\s' .tool-versions | cut -f2 -d' ')" >>
215+
"$GITHUB_OUTPUT"
207216

208217
- name: Build OAS spec for non-release source
209218
if: ${{ needs.validate.outputs.is_release == 'false' }}
@@ -212,7 +221,7 @@ jobs:
212221
version: ${{ needs.validate.outputs.build_artifact_version }}
213222
apimEnv: ${{ needs.validate.outputs.apim_environment }}
214223
buildSandbox: ${{ inputs.build_sandbox }}
215-
nodejs_version: "22.22.0"
224+
nodejs_version: ${{ steps.toolversions.outputs.nodejs_version }}
216225
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
217226

218227
- name: Deploy proxy

0 commit comments

Comments
 (0)