Update readme (#20) #18
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: Publish image and deploy to staging | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| id-token: write # needed by aws-actions/configure-aws-credentials | |
| contents: read | |
| env: | |
| AWS_REGION: eu-west-1 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v2 | |
| with: | |
| platforms: all | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| install: true | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: arn:aws:iam::${{ secrets.AWS_STAGING_ACCOUNT_ID }}:role/${{ secrets.AWS_APPS_SALEOR_MCP_STAGING_CICD_ROLE_NAME }} | |
| aws-region: ${{ env.AWS_REGION }} | |
| - id: ecr-login | |
| name: Login to Amazon ECR | |
| uses: aws-actions/amazon-ecr-login@v2 | |
| with: | |
| registries: ${{ secrets.AWS_ECR_ACCOUNT }} | |
| - name: Evaluate image tags | |
| run: | | |
| IMAGE_REPOSITORY=${{ steps.ecr-login.outputs.registry }}/${{ secrets.ECR_REPOSITORY }} | |
| BRANCH_IMAGE_TAG=${{ github.ref_name }} | |
| UNIQUE_IMAGE_TAG=${BRANCH_IMAGE_TAG}-$(git rev-parse --short HEAD) | |
| IMAGE_TAGS=${IMAGE_REPOSITORY}:${BRANCH_IMAGE_TAG},${IMAGE_REPOSITORY}:${UNIQUE_IMAGE_TAG} | |
| echo "UNIQUE_IMAGE_TAG=${UNIQUE_IMAGE_TAG}" >> $GITHUB_ENV | |
| echo "IMAGE_TAGS=${IMAGE_TAGS}" >> $GITHUB_ENV | |
| - name: Build and push | |
| timeout-minutes: 20 | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ env.IMAGE_TAGS }} | |
| cache-from: type=gha,scope=buildkit-master | |
| cache-to: type=gha,scope=buildkit-master | |
| deploy: | |
| runs-on: ubuntu-24.04 | |
| needs: | |
| - publish | |
| steps: | |
| - name: Trigger staging deployment | |
| run: | | |
| set -x | |
| export GITHUB_TOKEN=$( \ | |
| curl --request GET --url ${{ secrets.VAULT_URL}} --header "Authorization: JWT ${{ secrets.VAULT_JWT }}" | jq -r .token \ | |
| ) | |
| gh api /repos/saleor/saleor-cloud-deployments/dispatches \ | |
| --input - <<< '{ | |
| "event_type": "saleor-mcp-staging", | |
| "client_payload": { | |
| "image_tag": "${{ env.UNIQUE_IMAGE_TAG }}" | |
| } | |
| }' |