Skip to content

Commit

Permalink
code build, image push
Browse files Browse the repository at this point in the history
  • Loading branch information
kinfinity committed Mar 5, 2024
1 parent ac760ab commit cb592d5
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/code-build2release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Build_Push_App
on:
workflow_dispatch:
pull_request:
branches:
- main

env:
IMAGE_TAG: $(echo ${{ github.sha }} | cut -c1-4)
NODE_VERSION: 20.11.1

jobs:
build_apps:
name: CodeBuild
permissions:
contents: read
issues: read
checks: write
pull-requests: write
runs-on: ubuntu-latest
environment: Dev
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}

- name: Install dependencies
run: npm install

- name: Build Next.js app
run: npm run build

images:
name: ImageBuild
needs: build_apps
runs-on: ubuntu-latest
environment: Dev
steps:
- name: Checkout repository
uses: actions/checkout@v4

# https://github.com/google-github-actions/auth
- name: Authenticate with Google Cloud
uses: 'google-github-actions/auth@v2'
with:
project_id: ${{ secrets.PROJECT_ID }}
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITYPROVIDER }}
service_account: ${{ secrets.GKE_SA_KEY }}

- name: Configure kubectl
uses: google-github-actions/setup-gcloud@v0
with:
project_id: ${{ secrets.PROJECT_ID }}
service_account_key: ${{ secrets.GKE_SA_KEY }}
export_default_credentials: true

- name: Build and Push Image
run: |
chmod +x ci/scripts/build-and-push-app.sh
python3 ci/scripts/build-and-push-all.py --config "ci/configs/pipeline-config.json" --gitsha ${{ env.IMAGE_TAG }} --registry gcr.io/${{ secrets.PROJECT_ID }}
env:
PROJECT_ID: ${{ secrets.PROJECT_ID }}

0 comments on commit cb592d5

Please sign in to comment.