Using GCP Access Token #181
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: vertx-base | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
permissions: | |
id-token: write | |
contents: write | |
packages: write | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Cache Maven dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-maven | |
- name: Set up Maven settings | |
run: cp ./travis/new-settings.xml ~/.m2/settings.xml | |
- name: Build and test with Maven | |
run: mvn -e -Pcoverage verify | |
- name: Show Surefire test reports on failure | |
if: failure() | |
run: | | |
for F in target/surefire-reports/*.txt; do echo $F; cat $F; echo; done | |
deploy-snapshots: | |
name: Deploy Snapshots | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Cache Maven dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-maven | |
- name: Set up Maven settings | |
run: cp ./travis/new-settings.xml ~/.m2/settings.xml | |
- 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 | |
env: | |
GCP_ACCESS_TOKEN: ${{ steps.auth.outputs.GCP_ACCESS_TOKEN }} |