This repository has been archived by the owner on Dec 9, 2024. It is now read-only.
Work in progress #40
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: Deploy on Google Cloud Platform | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# - name: Run Lint | |
# uses: golangci/golangci-lint-action@v3 | |
deploy: | |
runs-on: ubuntu-latest | |
needs: lint | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Authenticate to Google Cloud | |
uses: google-github-actions/auth@v1 | |
with: | |
credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }} | |
- name: Set up Google Cloud SDK | |
uses: google-github-actions/setup-gcloud@v1 | |
with: | |
project_id: ${{ secrets.GCP_PROJECT_ID }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Authenticate Docker | |
run: | | |
gcloud auth configure-docker --quiet ${{ secrets.REGION }}-docker.pkg.dev | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ${{ secrets.REGISTRY }}/${{ secrets.SERVICE_NAME }}:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Deploy | |
id: deploy | |
uses: google-github-actions/deploy-cloudrun@v1 | |
with: | |
service: ${{ secrets.SERVICE_NAME }} | |
image: ${{ secrets.REGISTRY }}/${{ secrets.SERVICE_NAME }}:latest | |
region: ${{ secrets.REGION }} | |
- name: "Check deployment" | |
run: curl -fsS -m 10 --retry 5 -o /dev/null "${{ steps.deploy.outputs.url }}" | |
- name: Setup Firebase Hosting | |
uses: firebaseextended/action-hosting-deploy@v0 | |
with: | |
channelID: live | |
repoToken: ${{ secrets.GITHUB_TOKEN }} | |
firebaseServiceAccount: ${{ secrets.GOOGLE_CREDENTIALS }} | |
projectId: ${{ secrets.GCP_PROJECT_ID }} | |
expires: 30d |