Feature (#41) #8
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: GCP-CD/CD | |
on: | |
push: | |
branches: ["main", "golden", "develop"] | |
pull_request: | |
types: [opened] | |
workflow_dispatch: | |
env: | |
PROJECT_ID: awwwards-clone-project | |
REGION: asia-south1 | |
REPOSITORY: asia-south1/docker.pkg.dev/awwwards-clone-project/awwwards-clone-repo/awwwards-clone | |
jobs: | |
deploy_to_artifact_registry: | |
runs-on: ubuntu-latest | |
steps: | |
# Github Code Checkout Action | |
- name: Git Checkout | |
uses: actions/checkout@v4 | |
# Install Dependencies for the application | |
- name: Install Dependencies | |
run: npm install | |
working-directory: /home/runner/work/Awwwards/Awwwards | |
# Building the application | |
- name: Build Application | |
run: npm run build | |
working-directory: /home/runner/work/Awwwards/Awwwards | |
# Authenticate with GCP | |
- name: Authenticate with GCP | |
uses: google-github-actions/auth@v2 | |
with: | |
credentials_json: "${{ secrets.GCP_SERVICE_ACCOUNT_TOKEN }}" | |
# Setup GCloud SDK | |
- name: 'Set up Cloud SDK' | |
uses: 'google-github-actions/setup-gcloud@v2' | |
with: | |
version: '>= 363.0.0' | |
- name: 'Use gcloud CLI' | |
run: 'gcloud info' | |
# Authentication with docker | |
- name: Docker Auth | |
run: |- | |
gcloud auth configure-docker ${{ env.REGION }}-docker.pkg.dev --quiet | |
- name: Build image | |
run: docker build . --file Dockerfile --tag ${{ env.REPOSITORY }} | |
working-directory: /home/runner/work/Awwwards/Awwwards | |
- name: Push image | |
run: docker push ${{ env.REPOSITORY }} | |