Skip to content

publish-mcr-image

publish-mcr-image #9

name: Push image to MCR
on:
repository_dispatch:
types: [ publish-mcr-image ]
permissions:
contents: write
packages: write
env:
GO_VERSION: '1.22'
IMAGE_NAME: 'workspace'
jobs:
build-publish-mcr-image:
runs-on:
labels: [ "self-hosted", "1ES.Pool=1es-aks-kaito-agent-pool-ubuntu" ]
environment: publish-mcr
steps:
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/[email protected]
with:
go-version: ${{ env.GO_VERSION }}
- name: Set Image tag
run: |
ver=${{ github.event.client_payload.tag }}
echo "IMG_TAG=${ver#"v"}" >> $GITHUB_ENV
- uses: actions/[email protected]
with:
fetch-depth: 0
submodules: true
ref: ${{ github.event.client_payload.tag }}
- name: Authenticate to ACR
run: |
az login --identity
az acr login -n ${{ secrets.KAITO_MCR_REGISTRY }}
- name: 'Build and Publish to MCR'
id: Publish
run: |
OUTPUT_TYPE=type=registry make docker-build-workspace
env:
VERSION: ${{ needs.get-tag.outputs.release-tag }}
REGISTRY: ${{ secrets.KAITO_MCR_REGISTRY }}/public/aks/kaito
create-release:
runs-on: ubuntu-latest
needs: [ build-publish-mcr-image ]
steps:
- name: 'Dispatch release tag'
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
event-type: create-release
client-payload: '{"tag": "${{ github.event.client_payload.tag }}"}'