Build and publish to MCR #23
Workflow file for this run
This file contains 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
# This Github action builds and publishes image to Azure Container Registry (ACR), | |
# from where it is automatically propagated to Microsoft Container Registry (MCR). | |
name: Build and publish to MCR | |
on: | |
workflow_dispatch: | |
inputs: | |
releaseTag: | |
description: 'Release tag to publish, defaults to the latest one' | |
type: string | |
permissions: | |
contents: read | |
jobs: | |
prepare-variables: | |
runs-on: | |
labels: [self-hosted, "1ES.Pool=${{ vars.RELEASE_1ES_POOL }}"] | |
outputs: | |
release_tag: ${{ steps.vars.outputs.release_tag }} | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 | |
with: | |
fetch-depth: 0 | |
- name: 'Set output variables' | |
id: vars | |
run: | | |
RELEASE_TAG=${{ inputs.releaseTag }} | |
if [ -z "$RELEASE_TAG" ]; then | |
RELEASE_TAG="$(git describe --tags "$(git rev-list --tags --max-count=1)")" | |
echo "The user input release tag is empty, will use the latest tag $RELEASE_TAG." | |
fi | |
echo "release_tag=$RELEASE_TAG" >> "$GITHUB_OUTPUT" | |
publish-images: | |
permissions: | |
contents: read | |
id-token: write # This is required for requesting the JWT | |
runs-on: | |
labels: [self-hosted, "1ES.Pool=${{ vars.RELEASE_1ES_POOL }}"] | |
needs: prepare-variables | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 | |
with: | |
ref: ${{ needs.prepare-variables.outputs.release_tag }} | |
- uses: ./.github/actions/install-deps | |
- name: Build and publish image | |
run: | | |
az login --identity | |
RELEASE_ACR=${{ secrets.AZURE_REGISTRY }} ./hack/release/release.sh |