Skip to content

Test Depot

Test Depot #2

Workflow file for this run

name: Deploy with Depot
on:
pull_request:
types: [opened, synchronize]
permissions:
id-token: write
contents: read
env:
PROJECT: 'cpg-common'
DOCKER_PREFIX: 'australia-southeast1-docker.pkg.dev'
IMAGES_PREFIX: 'australia-southeast1-docker.pkg.dev/cpg-common/images-dev'
jobs:
get_next_version:
runs-on: ubuntu-latest
environment: production
outputs:
matrix: ${{ steps.get_next_version.outputs.next_version }}
steps:
- name: 'Checkout repo'
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- id: 'google-cloud-auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v2'
with:
workload_identity_provider: 'projects/1051897107465/locations/global/workloadIdentityPools/github-pool/providers/github-provider'
service_account: '[email protected]'
- id: 'google-cloud-sdk-setup'
name: 'Set up Cloud SDK'
uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ env.PROJECT }}
- name: 'Get current version'
id: get_next_version
run: |
next_version=$(python .github/workflows/get_version.py)
echo "next_version=$next_version" >> "$GITHUB_OUTPUT"
# Deploy the images that have changed to the registry
deploy_images:
runs-on: ubuntu-latest
environment: production
needs:
- get_next_version
if: ${{ needs.get_next_version.outputs.matrix != '{}' && needs.get_next_version.outputs.matrix != '' }}
strategy:
matrix: ${{ fromJson(needs.get_next_version.outputs.matrix) }}
env:
DOCKER_BUILDKIT: 1
BUILDKIT_PROGRESS: plain
CLOUDSDK_CORE_DISABLE_PROMPTS: 1
steps:
- uses: actions/checkout@v4
- id: 'google-cloud-auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v2'
with:
workload_identity_provider: 'projects/1051897107465/locations/global/workloadIdentityPools/github-pool/providers/github-provider'
service_account: '[email protected]'
- id: 'google-cloud-sdk-setup'
name: 'Set up Cloud SDK'
uses: google-github-actions/setup-gcloud@v2
- run: |
gcloud auth configure-docker ${{ env.DOCKER_PREFIX }}
- name: Set up Depot CLI
uses: depot/setup-action@v1
- name: Build and push
uses: depot/build-push-action@v1
with:
# if no depot.json file is at the root of your repo, you must specify the project id
project: fmrzwks01h
context: images/${{ matrix.name }}
push: true
tags: ${{ env.IMAGES_PREFIX }}/${{ matrix.name }}:${{ matrix.tag }}
provenance: true