Skip to content

chore: add deps

chore: add deps #2

name: Build and Push to Artifact Registry
on:
push:
branches:
- 'main'
- 'cicd'
env:
PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
AR_REGION: asia-southeast1
REPOSITORY: newsletter-digest
IMAGE_NAME: discord-bot
jobs:
build-and-push:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Google Auth
id: auth
uses: 'google-github-actions/auth@v0'
with:
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
- name: Set up Cloud SDK
uses: 'google-github-actions/setup-gcloud@v0'
- name: Configure Docker
run: |
gcloud auth configure-docker ${{ env.AR_REGION }}-docker.pkg.dev --quiet
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push final Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: |
${{ env.AR_REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
${{ env.AR_REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.IMAGE_NAME }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max