Trigger Image Build #13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Trigger Image Build | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| image_version: | |
| description: 'Image version - format X.Y.Z (e.g., 0.1.0)' | |
| required: true | |
| type: string | |
| jobs: | |
| trigger: | |
| name: Trigger Infra Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Encode token | |
| id: encode | |
| env: | |
| SOURCE_REPO_READ_TOKEN: ${{ secrets.SOURCE_REPO_READ_TOKEN }} | |
| run: | | |
| ENCODED_TOKEN=$(echo -n "${SOURCE_REPO_READ_TOKEN}" | base64 | tr -d '\n') | |
| echo "encoded_token=${ENCODED_TOKEN}" >> $GITHUB_OUTPUT | |
| - name: Trigger infra repo build | |
| uses: peter-evans/repository-dispatch@v3 | |
| with: | |
| token: ${{ secrets.PS_IMAGE_BUILDER_TOKEN }} | |
| repository: Redis-ProfessionalService/ps-portal-image-builder | |
| event-type: build-image | |
| client-payload: |- | |
| { | |
| "source_repo_url": "https://github.com/${{ github.repository }}", | |
| "source_repo_ref": "${{ github.ref_name }}", | |
| "image_name": "${{ github.repository }}", | |
| "image_version": "${{ inputs.image_version }}", | |
| "source_dir": "", | |
| "clone_token": "${{ steps.encode.outputs.encoded_token }}" | |
| } | |
| - name: Build triggered | |
| run: | | |
| echo "✅ Build triggered on infra repo" | |
| echo "" | |
| echo "📦 Build Details:" | |
| echo " Source Repo: https://github.com/${{ github.repository }}" | |
| echo " Source Ref: ${{ github.ref_name }}" | |
| echo " Image Version: ${{ inputs.image_version }}" | |
| echo "" | |
| echo "🔗 Check build status at:" | |
| echo " https://github.com/Redis-ProfessionalService/raffamendes-infra-test/actions" |