initial commit #1
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
name: Docs Image Build and Push | ||
on: | ||
push: | ||
branches: | ||
- mkdocs-publish | ||
paths: | ||
- '**' | ||
repository_dispatch: | ||
types: | ||
# FULL WORKFLOW UNAVAILABLE | ||
# - trigger-workflow-from-repo1 | ||
# - trigger-workflow-from-repo2 | ||
# - trigger-workflow-from-repo3 | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: 'Docker image tag (optional for manual trigger), e.g.: v0.2.22' | ||
required: false | ||
jobs: | ||
build_and_push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get GitHub App Installation Access Token | ||
id: token | ||
run: | | ||
TOKEN="$(npx obtain-github-app-installation-access-token ci ${{ secrets.GH_APP_CREDENTIALS_TOKEN }})" | ||
echo "::add-mask::$TOKEN" | ||
echo "token=$( echo "$TOKEN" )" >> $GITHUB_OUTPUT | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ steps.token.outputs.token }} | ||
- name: Login to GAR | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: PLACEHOLDER-docker.dev | ||
username: _json_key | ||
password: ${{ secrets.ARTIFACT_REGISTRY }} | ||
- name: Login to ACR | ||
uses: docker/login-action@v2 | ||
with: | ||
registry:PLACEHOLDER-.azurecr.io | ||
username: ${{ secrets.AZURE_CLIENT_ID }} | ||
password: ${{ secrets.AZURE_CLIENT_SECRET }} | ||
- name: Authenticate to Google Cloud | ||
uses: google-github-actions/auth@v1 | ||
with: | ||
credentials_json: ${{ secrets.ARTIFACT_REGISTRY }} | ||
- name: Build and push Docs image | ||
run: | | ||
if [ -z "${{ github.event.inputs.tag }}" ]; then \ | ||
make build GIT_TOKEN="x-access-token:${{ steps.token.outputs.token }}"; \ | ||
make push GIT_TOKEN="x-access-token:${{ steps.token.outputs.token }}" ; \ | ||
else \ | ||
make build GIT_TOKEN="x-access-token:${{ steps.token.outputs.token }}" IMAGE_VERSION_OVERRIDE=${{ github.event.inputs.tag }}; \ | ||
make push GIT_TOKEN="x-access-token:${{ steps.token.outputs.token }}" IMAGE_VERSION_OVERRIDE=${{ github.event.inputs.tag }}; \ | ||
fi |