fix middleware use #52
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: | |
push: | |
branches: [develop, main] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
set-environment: | |
name: π¨ Set Environment | |
runs-on: ubuntu-22.04 | |
outputs: | |
github-environment: ${{ steps.set-environment.outputs.environment }} | |
steps: | |
- name: β¬οΈ Checkout | |
uses: actions/checkout@v3 | |
- id: set-environment | |
name: π Set Environment | |
run: | | |
if [[ "${{ github.ref_name }}" == "main" ]]; then | |
echo "environment=production" >> $GITHUB_OUTPUT | |
else | |
echo "environment=develop" >> $GITHUB_OUTPUT | |
fi | |
build-and-deploy-to-google: | |
name: π Deploy to ${{github.ref_name}} | |
needs: set-environment | |
environment: ${{ needs.set-environment.outputs.github-environment }} | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: β¬οΈ Checkout | |
uses: actions/checkout@v3 | |
- id: 'auth' | |
name: πͺͺ Google Auth | |
uses: google-github-actions/auth@v1 | |
with: | |
credentials_json: '${{ secrets.GCP_CREDENTIALS }}' | |
- name: π Authorize Docker push | |
run: gcloud auth configure-docker | |
- name: ποΈ Build and π³ Push Container | |
run: |- | |
docker build -t gcr.io/${{ secrets.GCP_PROJECT }}/${{ secrets.GOOGLE_CLOUD_RUN_SERVICE }}:${{ github.sha }} . | |
docker push gcr.io/${{ secrets.GCP_PROJECT }}/${{ secrets.GOOGLE_CLOUD_RUN_SERVICE }}:${{ github.sha }} | |
- id: 'deploy' | |
name: π Deploy to Cloud Run | |
uses: google-github-actions/deploy-cloudrun@v1 | |
with: | |
service: ${{ secrets.GOOGLE_CLOUD_RUN_SERVICE }} | |
image: 'gcr.io/${{ secrets.GCP_PROJECT }}/${{ secrets.GOOGLE_CLOUD_RUN_SERVICE }}:${{ github.sha }}' |