8585 needs : [validate-push-release-request]
8686 outputs :
8787 gh-releases-matrix : ${{ steps.release-image.outputs.gh-releases-matrix }}
88+ is-public-release : ${{ steps.release-type.outputs.is-public-release }}
89+ is-pro-release : ${{ steps.release-type.outputs.is-pro-release }}
8890 env :
8991 IS_PROD : ${{ ! startsWith(inputs.oci-image-name, 'mock-') }}
9092 RELEASES_BRANCH : _releases
@@ -108,6 +110,62 @@ jobs:
108110 key : ${{ inputs.image-trigger-cache-key }}
109111 fail-on-cache-miss : true
110112
113+
114+ # Use yq to find out if `pro-release` is present and non-empty in the image trigger.
115+ - name : Release type
116+ id : release-type
117+ run : |
118+ set -e
119+ if [[ "$RUNNER_DEBUG" == "1" ]]; then
120+ set -x
121+ fi
122+ source src/shared/logs.sh
123+ image_trigger_file="oci/${INPUTS_OCI_IMAGE_NAME}/image.yaml"
124+ yq eval '.["pro-release"] | length > 0' "$image_trigger_file" > is_pro_release.txt
125+ yq eval '.["release"] | length > 0' "$image_trigger_file" > is_public_release.txt
126+ is_pro_release=$(cat is_pro_release.txt)
127+ echo "is-pro-release=$is_pro_release" >> "$GITHUB_OUTPUT"
128+ is_public_release=$(cat is_public_release.txt)
129+ echo "is-public-release=$is_public_release" >> "$GITHUB_OUTPUT"
130+ env :
131+ INPUTS_OCI_IMAGE_NAME : ${{ inputs.oci-image-name }}
132+
133+ # Download the image if `pro-release` is present and non-empty in the image trigger.
134+ # pattern should match <image_name>_<version>-<base>_*, e.g., mock-rock_1.2-22.04_*
135+ - name : Download image artifact
136+ id : download-image-artifact
137+ uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
138+ if : ${{ steps.release-type.outputs.is-pro-release == 'true' }}
139+ env :
140+ INPUTS_OCI_IMAGE_NAME : ${{ inputs.oci-image-name }}
141+ with :
142+ pattern : +([A-Za-z0-9-])_+([A-Za-z0-9.-])-[0-9][0-9].[0-9][0-9]_+([0-9])
143+ merge-multiple : true
144+
145+ # Decrypt the Pro image artifact being downloaded.
146+ # They are encrypted with GPG, and has the same name as the downloaded artifact, but with .gpg extension.
147+ # put a for loop to use the script ./.github/action/crypt-artifact/crypt-artifact.sh to decrypt the artifact,
148+ - name : Decrypt Pro image artifact
149+ id : decrypt-pro-image-artifact
150+ if : ${{ steps.release-type.outputs.is-pro-release == 'true' }}
151+ run : |
152+ set -e
153+ if [[ "$RUNNER_DEBUG" == "1" ]]; then
154+ set -x
155+ fi
156+ source src/shared/logs.sh
157+ artifact_path="${{ steps.download-image-artifact.outputs.download-path }}"
158+ for artifact in $artifact_path/*.gpg; do
159+ if [ -f "$artifact" ]; then
160+ log_info "Decrypting artifact: $artifact"
161+ ./.github/actions/crypt-artifact/crypt-artifact.sh decrypt \
162+ -i "$artifact" \
163+ -p "${{ secrets.ROCKS_PRO_ARTIFACT_PASSPHRASE }}"
164+ else
165+ log_info "No .gpg artifacts found to decrypt."
166+ fi
167+ done
168+
111169 - uses : actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
112170 with :
113171 python-version : " 3.x"
@@ -139,6 +197,7 @@ jobs:
139197
140198 - name : Do releases from ${{ inputs.oci-image-name }}
141199 id : release-image
200+ if : ${{ steps.release-type.outputs.is-public-release == 'true' }}
142201 env :
143202 # GH has issues with boolean expressions
144203 # https://github.com/actions/runner/issues/1483
@@ -174,25 +233,72 @@ jobs:
174233 --all-revision-tags "${STEPS_GET_ALL_CANONICAL_TAGS_OUTPUTS_CANONICAL_TAGS_FILE}" \
175234 --ghcr-repo "${{ github.repository_owner }}/oci-factory"
176235
236+ - name : Do Pro releases from ${{ inputs.oci-image-name }}
237+ if : ${{ steps.release-type.outputs.is-pro-release == 'true' }}
238+ id : release-pro-image
239+ env :
240+ # GH has issues with boolean expressions
241+ ACR_CREDS_USR : ${{ env.IS_PROD == 'true' && secrets.ACR_CREDS_USR || secrets.ACR_CREDS_USR_DEV }}
242+ ACR_CREDS_PSW : ${{ env.IS_PROD == 'true' && secrets.ACR_CREDS_PSW || secrets.ACR_CREDS_PSW_DEV }}
243+ ACR_REGISTRY : ${{ env.IS_PROD == 'true' && 'ubuntu.azurecr.io' || secrets.ACR_REGISTRY_DEV }}
244+ PYTHONUNBUFFERED : 1
245+ INPUTS_OCI_IMAGE_NAME : ${{ inputs.oci-image-name }}
246+ STEPS_GET_ALL_CANONICAL_TAGS_OUTPUTS_CANONICAL_TAGS_FILE : ${{ steps.get-all-canonical-tags.outputs.canonical-tags-file }}
247+ run : |
248+ set -e
249+ if [[ "$RUNNER_DEBUG" == "1" ]]; then
250+ set -x
251+ fi
252+ source src/shared/logs.sh
253+ log_info "Running in production? $([[ "$IS_PROD" == "true" ]] && echo YES || echo NO)"
254+
255+ python3 -m src.image.release \
256+ --image-trigger oci/${INPUTS_OCI_IMAGE_NAME}/image.yaml \
257+ --image-name ${INPUTS_OCI_IMAGE_NAME} \
258+ --all-releases oci/${INPUTS_OCI_IMAGE_NAME}/_releases.json \
259+ --all-revision-tags "${STEPS_GET_ALL_CANONICAL_TAGS_OUTPUTS_CANONICAL_TAGS_FILE}" \
260+ --pro
261+
177262 - name : Update _releases.json
263+ if : ${{ steps.release-type.outputs.is-public-release == 'true' }}
178264 run : |
179265 python3 -m src.image.release \
180266 --image-trigger oci/${INPUTS_OCI_IMAGE_NAME}/image.yaml \
181267 --image-name ${INPUTS_OCI_IMAGE_NAME} \
182268 --all-releases oci/${INPUTS_OCI_IMAGE_NAME}/_releases.json \
183269 --all-revision-tags "${STEPS_GET_ALL_CANONICAL_TAGS_OUTPUTS_CANONICAL_TAGS_FILE}" \
184270 --update-releases-json
271+
272+ - name : Update _pro_releases.json
273+ if : ${{ steps.release-type.outputs.is-pro-release == 'true' }}
274+ run : |
275+ python3 -m src.image.release \
276+ --image-trigger oci/${INPUTS_OCI_IMAGE_NAME}/image.yaml \
277+ --image-name ${INPUTS_OCI_IMAGE_NAME} \
278+ --all-releases oci/${INPUTS_OCI_IMAGE_NAME}/_pro_releases.json \
279+ --all-revision-tags "${STEPS_GET_ALL_CANONICAL_TAGS_OUTPUTS_CANONICAL_TAGS_FILE}" \
280+ --update-releases-json \
281+ --pro
185282 env :
186283 INPUTS_OCI_IMAGE_NAME : ${{ inputs.oci-image-name }}
187284 STEPS_GET_ALL_CANONICAL_TAGS_OUTPUTS_CANONICAL_TAGS_FILE : ${{ steps.get-all-canonical-tags.outputs.canonical-tags-file }}
188285
189286 - name : Overwrite _releases.json
287+ if : ${{ steps.release-type.outputs.is-public-release == 'true' }}
190288 run : |
191289 mkdir -p ${{ env.RELEASE_REPO_DIR }}/oci/${INPUTS_OCI_IMAGE_NAME}
192290 cp oci/${INPUTS_OCI_IMAGE_NAME}/_releases.json ${{ env.RELEASE_REPO_DIR }}/oci/${INPUTS_OCI_IMAGE_NAME}/_releases.json
193291 env :
194292 INPUTS_OCI_IMAGE_NAME : ${{ inputs.oci-image-name }}
195293
294+ - name : Overwrite _pro_releases.json
295+ if : ${{ steps.release-type.outputs.is-pro-release == 'true' }}
296+ run : |
297+ mkdir -p ${{ env.RELEASE_REPO_DIR }}/oci/${INPUTS_OCI_IMAGE_NAME}
298+ cp oci/${INPUTS_OCI_IMAGE_NAME}/_pro_releases.json ${{ env.RELEASE_REPO_DIR }}/oci/${INPUTS_OCI_IMAGE_NAME}/_pro_releases.json
299+ env :
300+ INPUTS_OCI_IMAGE_NAME : ${{ inputs.oci-image-name }}
301+
196302 # Commit with actor's GitHub noreply email to pass CLA and keep the privacy of the actor
197303 # Use force push, to bypass the branch protection rules
198304 - name : Commit oci/${{ inputs.oci-image-name }}/_releases.json
@@ -207,6 +313,9 @@ jobs:
207313 update-documentation :
208314 name : Update documentation
209315 needs : [do-releases]
316+ # Documentation should only be updated for public releases, not for pro releases.
317+ # As ACR does not have a Web UI.
318+ if : ${{ needs.do-releases.outputs.is-public-release == 'true' }}
210319 uses : ./.github/workflows/Documentation.yaml
211320 with :
212321 oci-image-name : " ${{ inputs.oci-image-name }}"
0 commit comments