Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/build-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,59 @@ jobs:
echo ""
echo "No se ha ejecutado Helm, kubectl, despliegue en EKS, Terraform apply ni Terraform destroy desde este repositorio."
} >> "$GITHUB_STEP_SUMMARY"

- name: Notify infra-apps PRE deployment
if: ${{ success() }}
env:
INFRA_APPS_DISPATCH_TOKEN: ${{ secrets.INFRA_APPS_DISPATCH_TOKEN }}
IMAGE_TAG: ${{ steps.image.outputs.image_tag }}
shell: bash
run: |
set -euo pipefail

if [[ -z "${INFRA_APPS_DISPATCH_TOKEN}" ]]; then
echo "::notice::INFRA_APPS_DISPATCH_TOKEN is not configured. Skipping infra-apps repository_dispatch."
{
echo ""
echo "No se ha notificado a infra-apps porque falta el secret \`INFRA_APPS_DISPATCH_TOKEN\`."
} >> "$GITHUB_STEP_SUMMARY"
exit 0
fi

if [[ "${IMAGE_TAG}" != sha-* ]]; then
echo "::error::Image tag must start with sha-."
exit 1
fi

payload="$(jq -n \
--arg event_type "deploy-vestimenta-pre" \
--arg environment "pre" \
--arg component "frontend" \
--arg image_tag "${IMAGE_TAG}" \
--arg source_repo "${GITHUB_REPOSITORY}" \
--arg source_sha "${GITHUB_SHA}" \
--arg source_run_id "${GITHUB_RUN_ID}" \
'{
event_type: $event_type,
client_payload: {
environment: $environment,
component: $component,
image_tag: $image_tag,
source_repo: $source_repo,
source_sha: $source_sha,
source_run_id: $source_run_id
}
}')"

curl --fail-with-body --show-error --silent \
--request POST \
--url "https://api.github.com/repos/gesplan-idi/infra-apps/dispatches" \
--header "Accept: application/vnd.github+json" \
--header "Authorization: Bearer ${INFRA_APPS_DISPATCH_TOKEN}" \
--header "X-GitHub-Api-Version: 2022-11-28" \
--data "${payload}"

{
echo ""
echo "Repository dispatch enviado a \`gesplan-idi/infra-apps\` para desplegar \`${IMAGE_TAG}\` en PRE."
} >> "$GITHUB_STEP_SUMMARY"
Loading