Skip to content

Commit

Permalink
Fix WF.
Browse files Browse the repository at this point in the history
  • Loading branch information
etvt committed Nov 24, 2023
1 parent 6c83161 commit 92301fe
Showing 1 changed file with 53 additions and 50 deletions.
103 changes: 53 additions & 50 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build and Push Docker image

on:
push:
branches: [ "master" ]
branches: [ "fix_wf" ]
pull_request:
branches: [ "master" ]

Expand All @@ -16,53 +16,56 @@ jobs:
id-token: 'write'

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/[email protected]
with:
context: .
file: Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ghcr.io/etvt/aitestdrive:latest
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Login to Google Cloud
id: 'google-cloud-auth'
if: github.event_name != 'pull_request'
uses: 'google-github-actions/auth@v1'
with:
workload_identity_provider: '${{ secrets.WIF_PROVIDER }}'
service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}'

- name: Set up Cloud SDK
uses: 'google-github-actions/setup-gcloud@v1'
with:
project_id: '${{ env.PROJECT_ID }}'

- name: Docker auth
run: |-
gcloud auth configure-docker gcr.io
- name: Echo Project ID
run: echo "Project ID is $PROJECT_ID"

- name: Build and push Docker image to GCR
uses: docker/[email protected]
with:
context: .
file: Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: gcr.io/${{ env.PROJECT_ID }}/aitestdrive:latest
cache-from: type=gha
cache-to: type=gha,mode=max
# - name: Checkout repository
# uses: actions/checkout@v3
#
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
#
# - name: Login to GitHub Container Registry
# if: github.event_name != 'pull_request'
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Build and push Docker image
# uses: docker/[email protected]
# with:
# context: .
# file: Dockerfile
# push: ${{ github.event_name != 'pull_request' }}
# tags: ghcr.io/etvt/aitestdrive:latest
# cache-from: type=gha
# cache-to: type=gha,mode=max
#
# - name: Login to Google Cloud
# id: 'google-cloud-auth'
# if: github.event_name != 'pull_request'
# uses: 'google-github-actions/auth@v1'
# with:
# workload_identity_provider: '${{ secrets.WIF_PROVIDER }}'
# service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}'
#
# - name: Set up Cloud SDK
# uses: 'google-github-actions/setup-gcloud@v1'
# with:
# project_id: '${{ env.PROJECT_ID }}'
#
# - name: Docker auth
# run: |-
# gcloud auth configure-docker gcr.io
#
# - name: Build and push Docker image to GCR
# uses: docker/[email protected]
# with:
# context: .
# file: Dockerfile
# push: ${{ github.event_name != 'pull_request' }}
# tags: gcr.io/${{ env.PROJECT_ID }}/aitestdrive:latest
# cache-from: type=gha
# cache-to: type=gha,mode=max

0 comments on commit 92301fe

Please sign in to comment.