-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (59 loc) · 2.09 KB
/
docs-image-build-push.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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