Skip to content

Commit

Permalink
ci: add missing id-token:write permission for Google Cloud (#1276)
Browse files Browse the repository at this point in the history
* ci: add missing id-token permission for gc auth

Signed-off-by: KeisukeYamashita <[email protected]>

* ci: add missing `actions/checkout` before google cloud auth

Signed-off-by: KeisukeYamashita <[email protected]>

---------

Signed-off-by: KeisukeYamashita <[email protected]>
  • Loading branch information
KeisukeYamashita authored Oct 20, 2024
1 parent e828520 commit f27d508
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/cron_ion_token_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@ env:
jobs:
update_ion_token:
runs-on: ubuntu-latest
permissions:
contents: read # To checkout
id-token: write # To authenticate with Google Cloud using OIDC
steps:
- uses: actions/checkout@v4

- uses: google-github-actions/auth@v2
with:
service_account: ${{ secrets.GCP_SA_EMAIL }}
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER}}
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
- name: Download reearth config
Expand Down
20 changes: 16 additions & 4 deletions .github/workflows/deploy_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ jobs:
name: Deploy web to test env
if: github.event.repository.full_name == 'reearth/reearth-cms' && github.event.workflow_run.name == 'ci-web' && github.event.workflow_run.conclusion != 'failure' && github.event.workflow_run.head_branch == 'main'
runs-on: ubuntu-latest
permissions:
contents: read # To checkout
id-token: write # To authenticate with Google Cloud using OIDC
steps:
- uses: actions/create-github-app-token@v1
id: app-token
Expand All @@ -56,7 +59,7 @@ jobs:
- uses: google-github-actions/auth@v2
with:
service_account: ${{ secrets.GCP_SA_EMAIL }}
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER}}
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
- name: Deploy
Expand All @@ -66,13 +69,16 @@ jobs:
name: Deploy server to test env
runs-on: ubuntu-latest
if: github.event.repository.full_name == 'reearth/reearth-cms' && github.event.workflow_run.name == 'server-build' && github.event.workflow_run.conclusion != 'failure' && github.event.workflow_run.head_branch == 'main'
permissions:
contents: read # To checkout
id-token: write # To authenticate with Google Cloud using OIDC
steps:
- uses: actions/checkout@v4

- uses: google-github-actions/auth@v2
with:
service_account: ${{ secrets.GCP_SA_EMAIL }}
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER}}
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
- name: Configure docker
Expand All @@ -94,13 +100,16 @@ jobs:
name: Deploy web to test env
runs-on: ubuntu-latest
if: github.event.repository.full_name == 'reearth/reearth-cms' && github.event.workflow_run.name == 'web-build' && github.event.workflow_run.conclusion != 'failure' && github.event.workflow_run.head_branch == 'main'
permissions:
contents: read # To checkout
id-token: write # To authenticate with Google Cloud using OIDC
steps:
- uses: actions/checkout@v4

- uses: google-github-actions/auth@v2
with:
service_account: ${{ secrets.GCP_SA_EMAIL }}
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER}}
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
- name: Configure docker
Expand All @@ -122,13 +131,16 @@ jobs:
name: Deploy worker to test env
runs-on: ubuntu-latest
if: github.event.repository.full_name == 'reearth/reearth-cms' && github.event.workflow_run.name == 'worker-build' && github.event.workflow_run.conclusion != 'failure' && github.event.workflow_run.head_branch == 'main'
permissions:
contents: read # To checkout
id-token: write # To authenticate with Google Cloud using OIDC
steps:
- uses: actions/checkout@v4

- uses: google-github-actions/auth@v2
with:
service_account: ${{ secrets.GCP_SA_EMAIL }}
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER}}
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
- name: Configure docker
Expand Down

0 comments on commit f27d508

Please sign in to comment.