Skip to content

Commit 793924a

Browse files
authored
Merge pull request #225 from fairagro/feature/fix_release_body
Feature/fix release body
2 parents ad5223f + cd2ce0d commit 793924a

1 file changed

Lines changed: 54 additions & 36 deletions

File tree

.github/workflows/reusable-release.yml

Lines changed: 54 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -204,44 +204,51 @@ jobs:
204204
run: |
205205
COMPONENT=$(echo '${{ inputs.components }}' | jq -r '.[0]')
206206
DH_IMAGE="${{ env.DOCKERHUB_NAMESPACE }}/${{ env.IMAGE_BASE_NAME }}-${COMPONENT}:${{ inputs.version }}"
207+
DH_URL="https://hub.docker.com/r/${{ env.DOCKERHUB_NAMESPACE }}/${{ env.IMAGE_BASE_NAME }}-${COMPONENT}"
207208
REPO_LOWER=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
208209
GHCR_IMAGE="ghcr.io/${REPO_LOWER}/${COMPONENT}:${{ inputs.version }}"
210+
GHCR_URL="https://ghcr.io/${REPO_LOWER}/${COMPONENT}"
209211
TAG="${{ needs.create-release-tag.outputs.timestamp }}-${{ inputs.tag_prefix }}${{ inputs.version }}"
210212
REPO_BASENAME=$(basename "${{ github.repository }}")
211213
PYPI_VERSION="${{ inputs.pep440_version || inputs.version }}"
212214
PYPI_REGISTRY=$([ "${{ inputs.release_type }}" = "final" ] && echo "https://pypi.org" || echo "https://test.pypi.org")
215+
DOCKER_SUCCESS=$([[ "${{ needs.push-dockerhub.result }}" == "success" || "${{ needs.push-ghcr.result }}" == "success" ]] && echo "true" || echo "false")
216+
PYPI_SUCCESS=$([[ "${{ needs.publish-pypi.result }}" == "success" ]] && echo "true" || echo "false")
213217
214218
{
215-
echo "## Docker Images"
216-
echo ""
217-
echo "| Platform | Image Digest |"
218-
echo "| --- | --- |"
219-
if [[ "${{ needs.push-dockerhub.result }}" == "success" ]]; then
220-
echo "| linux/amd64 (DockerHub) | \`${{ needs.push-dockerhub.outputs.digest }}\` |"
221-
fi
222-
echo ""
223-
echo "### Registry Links"
224-
if [[ "${{ needs.push-dockerhub.result }}" == "success" ]]; then
225-
echo "* **DockerHub**: [${DH_IMAGE}](https://hub.docker.com/r/${{ env.DOCKERHUB_NAMESPACE }}/${{ env.IMAGE_BASE_NAME }}-${COMPONENT})"
219+
# --- Docker section ---
220+
if [[ "$DOCKER_SUCCESS" == "true" ]]; then
221+
echo "## Docker Image"
226222
echo ""
227-
echo "Pull from DockerHub:"
228-
echo '```bash'
229-
echo "docker pull ${DH_IMAGE}"
230-
echo '```'
231-
fi
232-
if [[ "${{ needs.push-ghcr.result }}" == "success" ]]; then
233-
echo "* **GHCR**: \`${GHCR_IMAGE}\`"
223+
if [[ "${{ needs.push-dockerhub.result }}" == "success" ]]; then
224+
echo "| Platform | Image Digest |"
225+
echo "| --- | --- |"
226+
echo "| linux/amd64 | \`${{ needs.push-dockerhub.outputs.digest }}\` |"
227+
echo ""
228+
fi
229+
if [[ "${{ needs.push-dockerhub.result }}" == "success" ]]; then
230+
echo "**[Pull from DockerHub](${DH_URL})**"
231+
echo '```bash'
232+
echo "docker pull ${DH_IMAGE}"
233+
echo '```'
234+
echo ""
235+
fi
236+
if [[ "${{ needs.push-ghcr.result }}" == "success" ]]; then
237+
echo "**[Pull from GHCR](${GHCR_URL})**"
238+
echo '```bash'
239+
echo "docker pull ${GHCR_IMAGE}"
240+
echo '```'
241+
echo ""
242+
fi
243+
else
244+
echo "## Docker Image"
234245
echo ""
235-
echo "Pull from GHCR:"
236-
echo '```bash'
237-
echo "docker pull ${GHCR_IMAGE}"
238-
echo '```'
239-
fi
240-
if [[ "${{ needs.push-dockerhub.result }}" != "success" && "${{ needs.push-ghcr.result }}" != "success" ]]; then
241246
echo "_No Docker registries were successfully updated for this release._"
242-
fi
243-
if [[ "${{ needs.publish-pypi.result }}" == "success" ]]; then
244247
echo ""
248+
fi
249+
250+
# --- Python packages section ---
251+
if [[ "$PYPI_SUCCESS" == "true" ]]; then
245252
echo "## Python Packages"
246253
echo ""
247254
echo "Published to [$PYPI_REGISTRY]($PYPI_REGISTRY):"
@@ -250,22 +257,33 @@ jobs:
250257
echo "pip install fairagro-middleware-api-client==${PYPI_VERSION}"
251258
echo '```'
252259
echo ""
253-
echo "### Fallback (install from source)"
260+
fi
261+
262+
# --- Fallback section (shared clone/checkout, then per-artifact instructions) ---
263+
if [[ "$DOCKER_SUCCESS" == "true" || "$PYPI_SUCCESS" == "true" ]]; then
264+
echo "## Build from Source"
265+
echo ""
254266
echo '```bash'
255267
echo "git clone https://github.com/${{ github.repository }}.git"
256268
echo "cd ${REPO_BASENAME}"
257269
echo "git checkout ${TAG}"
258-
echo "pip install middleware/shared middleware/api_client"
259270
echo '```'
271+
echo ""
272+
if [[ "$DOCKER_SUCCESS" == "true" ]]; then
273+
echo "Build the Docker image:"
274+
echo '```bash'
275+
echo "docker build -f docker/Dockerfile.${COMPONENT} -t ${COMPONENT}:${{ inputs.version }} ."
276+
echo '```'
277+
echo ""
278+
fi
279+
if [[ "$PYPI_SUCCESS" == "true" ]]; then
280+
echo "Install Python packages:"
281+
echo '```bash'
282+
echo "pip install middleware/shared middleware/api_client"
283+
echo '```'
284+
echo ""
285+
fi
260286
fi
261-
echo ""
262-
echo "## Fallback (Build Docker image from source)"
263-
echo '```bash'
264-
echo "git clone https://github.com/${{ github.repository }}.git"
265-
echo "cd ${REPO_BASENAME}"
266-
echo "git checkout ${TAG}"
267-
echo "docker build -f docker/Dockerfile.${COMPONENT} -t ${COMPONENT}:${{ inputs.version }} ."
268-
echo '```'
269287
} > release-body.md
270288
271289
- name: Create GitHub Release (Draft)

0 commit comments

Comments
 (0)