Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update actions to use google-github-actions/auth@v1 and fix input syntax #118

Merged
merged 5 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 31 additions & 8 deletions .github/workflows/deploy_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
- main
workflow_dispatch:

permissions:
id-token: write
contents: read

env:
PROJECT: 'cpg-common'
CONFIG_DESTINATION: 'gs://cpg-config/templates/images/images.toml'
Expand Down Expand Up @@ -52,10 +56,16 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: google-github-actions/setup-gcloud@v0
- id: "google-cloud-auth"
name: "Authenticate to Google Cloud"
uses: "google-github-actions/auth@v1"
with:
project_id: cpg-common
service_account_key: ${{ secrets.GCP_SERVER_DEPLOY_KEY }}
workload_identity_provider: "projects/1051897107465/locations/global/workloadIdentityPools/github-pool/providers/github-provider"
service_account: "gh-images-deployer@cpg-common.iam.gserviceaccount.com"

- id: "google-cloud-sdk-setup"
name: "Set up Cloud SDK"
uses: google-github-actions/setup-gcloud@v1

- run: |
gcloud auth configure-docker ${{ env.DOCKER_PREFIX }}
Expand Down Expand Up @@ -100,10 +110,16 @@ jobs:
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
cd -

- uses: google-github-actions/setup-gcloud@v0
- id: "google-cloud-auth"
name: "Authenticate to Google Cloud"
uses: "google-github-actions/auth@v1"
with:
project_id: cpg-common
service_account_key: ${{ secrets.GCP_SERVER_DEPLOY_KEY }}
workload_identity_provider: "projects/1051897107465/locations/global/workloadIdentityPools/github-pool/providers/github-provider"
service_account: "gh-images-deployer@cpg-common.iam.gserviceaccount.com"

- id: "google-cloud-sdk-setup"
name: "Set up Cloud SDK"
uses: google-github-actions/setup-gcloud@v1

- run: |
gcloud auth configure-docker ${{ env.DOCKER_PREFIX }}
Expand Down Expand Up @@ -140,11 +156,18 @@ jobs:
- name: "checkout repo"
uses: actions/checkout@v3

- name: "gcloud setup"
- id: "google-cloud-auth"
name: "Authenticate to Google Cloud"
uses: "google-github-actions/auth@v1"
with:
workload_identity_provider: "projects/1051897107465/locations/global/workloadIdentityPools/github-pool/providers/github-provider"
service_account: "gh-images-deployer@cpg-common.iam.gserviceaccount.com"

- id: "google-cloud-sdk-setup"
name: "Set up Cloud SDK"
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ env.PROJECT }}
service_account_key: ${{ secrets.GCP_SERVER_DEPLOY_KEY }}

- uses: actions/setup-python@v4
with:
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/deploy_container.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ on:
description: "Extra docker CLI params"
required: false

permissions:
id-token: write
contents: read

jobs:
deployImage:
runs-on: ubuntu-latest
Expand All @@ -31,11 +35,16 @@ jobs:
- name: "checkout repo"
uses: actions/checkout@v3

- name: "gcloud setup"
uses: google-github-actions/setup-gcloud@v0
- id: "google-cloud-auth"
name: "Authenticate to Google Cloud"
uses: "google-github-actions/auth@v1"
with:
project_id: analysis-runner
service_account_key: ${{ secrets.GCP_SERVER_DEPLOY_KEY }}
workload_identity_provider: "projects/1051897107465/locations/global/workloadIdentityPools/github-pool/providers/github-provider"
service_account: "gh-images-deployer@cpg-common.iam.gserviceaccount.com"

- id: "google-cloud-sdk-setup"
name: "Set up Cloud SDK"
uses: google-github-actions/setup-gcloud@v1

- name: "gcloud docker auth"
run: |
Expand Down