Skip to content

Update car-demo-updated-pipeline.yml #33

Update car-demo-updated-pipeline.yml

Update car-demo-updated-pipeline.yml #33

name: GCP Pipeline Updated
on:
push:
branches: [ main ]
env:
PROJECT_ID: ${{ secrets.GKE_PROJECT }}
jobs:
setup-build-publish-deploy:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- uses: actions/checkout@v3
- name: Set up JDK 19
uses: actions/setup-java@v3
with:
java-version: '19'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }}
- uses: 'google-github-actions/auth@v1'
with:
credentials_json: ${{ secrets.GKE_KEY }}
- uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ env.GKE_PROJECT }}
# Configure Docker to use the gcloud command-line tool as a credential
# helper for authentication
- name: configure docker
run: |-
gcloud --quiet auth configure-docker
- name: Configure Maven settings
run: |
#mkdir -p $HOME/.m2
rm $GITHUB_WORKSPACE/settings.xml
#echo "<settings><servers><server><id>github</id><username>sgknoldus</username><password>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</password></server></servers></settings>" > $HOME/.m2/settings.xml
#echo '<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> <servers> <server> <id>github</id> <username>sgknoldus</username> <password>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</password> </server> </servers></settings>' > $GITHUB_WORKSPACE/settings.xml
echo '<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> <servers> <server> <id>github</id> <username>sgknoldus</username> <password>${secrets.CUSTOM_GITHUB_USERNAME}</password> </server> </servers></settings>' > $GITHUB_WORKSPACE/settings.xml
- name: Build, Publish, and Deploy
run: |
#. apps-deployment-script.sh "us-east1"
echo "-----------printing ---------------"
#echo "${{ secrets.GITHUB_TOKEN }}" | base64
#echo "${{ env.GITHUB_TOKEN }}" | base64
echo "$GITHUB_TOKEN" | base64
env:
#GITHUB_USERNAME: ${{ secrets.CUSTOM_GITHUB_USERNAME }}
GITHUB_TOKEN: ${{ secrets.CUSTOM_GITHUB_TOKEN }}