Skip to content

Commit

Permalink
Using GCP Access Token
Browse files Browse the repository at this point in the history
  • Loading branch information
kcs-bandihareesh committed Oct 3, 2024
1 parent 123f29d commit 1817dc3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/vertx-base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ on:
workflow_dispatch:

permissions:
id-token: write
contents: write
packages: write
id-token: write

jobs:
test:
Expand Down Expand Up @@ -50,7 +50,6 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4


- name: Set up JDK 17
uses: actions/setup-java@v4
with:
Expand All @@ -67,15 +66,24 @@ jobs:
- name: Set up Maven settings
run: cp ./travis/new-settings.xml ~/.m2/settings.xml

- name: Authenticate to Google Cloud
- name: Authenticate using Workload Identity Federation
uses: google-github-actions/auth@v2
with:
project_id: 'som-rit-infrastructure-prod'
workload_identity_provider: 'projects/294515190965/locations/global/workloadIdentityPools/github/providers/susom-github'

- name: Generate GCP Access Token
id: auth
run: |
export GCP_ACCESS_TOKEN=$(gcloud auth print-access-token)
env:
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}

- name: Deploy Snapshots
run: |
mvn -Dmaven.wagon.http.retryHandler.count=5 \
-Dmaven.wagon.httpconnectionManager.ttlSeconds=30 \
-Dmaven.wagon.http.timeout=1200000 \
--batch-mode -e -DskipTests=true deploy -X
--batch-mode -e -DskipTests=true deploy -X
env:
GCP_ACCESS_TOKEN: ${{ steps.auth.outputs.GCP_ACCESS_TOKEN }}
20 changes: 12 additions & 8 deletions travis/new-settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,26 @@
<servers>
<server>
<id>artifact-registry</id>
<username>oauth2accesstoken</username>
<password>${env.GCP_ACCESS_TOKEN}</password>
<configuration>
<httpConfiguration>
<get>
<usePreemptive>true</usePreemptive>
</get>
<put>
<head>
<usePreemptive>true</usePreemptive>
</head>
<put>
<params>
<property>
<name>http.protocol.expect-continue</name>
<value>false</value>
</property>
</params>
</put>
<params>
<property>
<name>http.protocol.expect-continue</name>
<value>false</value>
</property>
</params>
</httpConfiguration>
</configuration>
</server>
</servers>
</settings>
</settings>

0 comments on commit 1817dc3

Please sign in to comment.