Merge pull request #14 from goormthon-Univ/refactor/chat-api #35
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: Node.js CI/CD | |
on: | |
push: | |
branches: [ main, dev, feat/cicd ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
setup-build-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '21.7.1' | |
- name: Install dependencies | |
run: npm install | |
# Run tests or other steps | |
# - name: Run tests | |
# run: npm test | |
- name: Create config directory and config.json | |
run: | | |
mkdir -p config | |
echo '${{ secrets.CONFIG_JSON }}' > config/config.json | |
- name: Authenticate to Google Cloud | |
uses: google-github-actions/auth@v0 | |
with: | |
credentials_json: '${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}' | |
# Build your project if necessary (e.g., TypeScript to JavaScript) | |
# - name: Build | |
# run: npm run build | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to Google Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: asia-northeast3-docker.pkg.dev | |
username: _json_key | |
password: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: asia-northeast3-docker.pkg.dev/ancient-ivy-416408/groom/${{ github.ref == 'refs/heads/main' && 'decalcomanie' || 'decalcomanie-dev' }}:latest | |
file: Dockerfile | |
context: . | |
- name: Deploy to Cloud Run | |
uses: google-github-actions/[email protected] | |
with: | |
service: ${{ github.ref == 'refs/heads/main' && 'decalcomanie' || 'decalcomanie-dev' }} | |
image: asia-northeast3-docker.pkg.dev/ancient-ivy-416408/groom/${{ github.ref == 'refs/heads/main' && 'decalcomanie' || 'decalcomanie-dev' }}:latest | |
region: asia-northeast3 | |
credentials: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} | |
# - name: Build and push Docker image | |
# uses: docker/build-push-action@v2 | |
# with: | |
# push: true | |
# tags: asia-northeast3-docker.pkg.dev/ancient-ivy-416408/groom/decalcomanie:latest | |
# file: Dockerfile | |
# context: . | |
# - name: Deploy to Cloud Run | |
# uses: google-github-actions/[email protected] | |
# with: | |
# service: decalcomanie | |
# image: asia-northeast3-docker.pkg.dev/ancient-ivy-416408/groom/decalcomanie:latest | |
# region: asia-northeast3 | |
# credentials: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} |