Update vertx-base.yaml with oauth access token #213
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: | |
schedule: | |
- cron: '0 0 * * *' # Cron job to run daily at midnight (UTC) | |
jobs: | |
test: | |
runs-on: ubuntu-20.04 | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: Check Maven version | |
run: mvn -version | |
- name: Authenticate to Google Cloud | |
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: Set up OAuth2 access token for Maven | |
run: | | |
echo "ACCESS_TOKEN=$(gcloud auth print-access-token)" >> $GITHUB_ENV | |
- name: Configure Maven Artifact Registry | |
run: | | |
echo "<settings> | |
<servers> | |
<server> | |
<id>artifact-registry</id> | |
<username>oauth2accesstoken</username> | |
<password>${env.ACCESS_TOKEN}</password> | |
</server> | |
</servers> | |
</settings>" > $HOME/.m2/settings.xml | |
# - name: Copy Maven settings | |
# run: cp ./travis/maven-settings.xml $HOME/.m2/settings.xml | |
- name: Cache Maven dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Install dependencies | |
run: mvn install -DskipTests=true | |
- name: Update version in pom.xml | |
run: sed -i "s/-SNAPSHOT/-build-${{ github.run_number }}/" pom.xml | |
- name: Display Surefire reports on failure | |
if: failure() | |
run: | | |
echo "\n=== SUREFIRE REPORTS ===\n" | |
for F in target/surefire-reports/*.txt; do echo $F; cat $F; echo; done | |
deploy_snapshots: | |
if: github.event_name == 'push' | |
name: Deploy Snapshots | |
runs-on: ubuntu-20.04 | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: Check Maven version | |
run: mvn -version | |
- name: Authenticate to Google Cloud | |
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: Configure Maven Artifact Registry | |
run: | | |
echo "<settings> | |
<servers> | |
<server> | |
<id>artifact-registry</id> | |
<username>oauth2accesstoken</username> | |
<password>$(gcloud auth print-access-token)</password> | |
</server> | |
</servers> | |
</settings>" > $HOME/.m2/settings.xml | |
# - name: Copy Maven settings | |
# run: cp ./travis/maven-settings.xml $HOME/.m2/settings.xml | |
- name: Cache Maven dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Deploy Snapshots | |
run: | | |
mvn -U -Dmaven.wagon.http.retryHandler.count=3 --batch-mode -e -DskipTests=true deploy -X |