-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
53 additions
and
50 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ name: Build and Push Docker image | |
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
branches: [ "fix_wf" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
|
@@ -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 |