Skip to content
Draft
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
28 changes: 8 additions & 20 deletions .github/workflows/promote.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ on:
TO_ENV:
type: string
required: true
ARTIFACT_ID:
type: string
required: false # only used for dev
ARTIFACT_RUN_ID:
type: string
required: false
secrets:
WF_GITHUB_TOKEN:
required: true
Expand Down Expand Up @@ -89,28 +83,22 @@ jobs:
fi
echo "service_name=$SERVICE_NAME" >> $GITHUB_OUTPUT

- name: Download dev artifact (only if FROM_ENV is dev)
if: ${{ inputs.FROM_ENV == 'dev' }}
uses: actions/download-artifact@v4
with:
name: service-${{ steps.serviceName.outputs.service_name }}-dev-${{ inputs.ARTIFACT_ID }}
path: dev-meta
github-token: ${{ secrets.WF_GITHUB_TOKEN }}
run-id: ${{ inputs.ARTIFACT_RUN_ID }}

- name: Ensure .deploys/service.json exists
run: |
mkdir -p .deploys
[ -f .deploys/service.json ] || echo '{}' > .deploys/service.json

- name: Guardrail - allow only staging -> production
run: |
if [ "${{ inputs.FROM_ENV }}" != "staging" ] || [ "${{ inputs.TO_ENV }}" != "production" ]; then
echo "Promote allowed only from staging -> production."
exit 1
fi

- name: Promote image metadata
id: promote
run: |
if [[ "${{ inputs.FROM_ENV }}" == "dev" ]]; then
cp dev-meta/service.json from.json
else
cp .deploys/service.json from.json
fi
cp .deploys/service.json from.json

echo "📦 Loaded metadata from ${{ inputs.FROM_ENV }}"
cat from.json
Expand Down