Docker publish externally #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: Docker publish externally | |
on: | |
workflow_dispatch: | |
inputs: | |
version_number: | |
description: "Version number of the Parabol application image to process" | |
required: true | |
jobs: | |
pull-and-upload: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: "read" | |
id-token: "write" | |
steps: | |
- name: Set up Docker | |
uses: docker/setup-buildx-action@v3 | |
- id: "auth" | |
name: "Authenticate to Google Cloud" | |
uses: "google-github-actions/auth@v2" | |
with: | |
token_format: "access_token" | |
workload_identity_provider: ${{ secrets.GCP_WI_PROVIDER_NAME }} | |
service_account: ${{ secrets.GCP_SA_EMAIL }} | |
- uses: "docker/login-action@v3" | |
with: | |
registry: ${{ secrets.GCP_DOCKER_REGISTRY }} | |
username: "oauth2accesstoken" | |
password: "${{ steps.auth.outputs.access_token }}" | |
- name: Pull Docker image from GCP | |
run: docker pull ${{ secrets.GCP_AR_PARABOL}}:v${{ github.event.inputs.version_number }} | |
- name: Push Docker image to the external repository | |
run: |- | |
gcloud container images add-tag -q \ | |
${{ secrets.GCP_AR_PARABOL }}:v${{ github.event.inputs.version_number }} \ | |
${{ secrets.GCP_AR_PARABOL_EXTERNAL }}:v${{ github.event.inputs.version_number }} |