build: Upgrade attendee-service version to 2.0.0 #4
Workflow file for this run
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: Build and Deploy attendee-service to Cloud Run | |
on: | |
push: | |
tags: | |
- "attendee-service-v*" | |
env: | |
PROJECT_ID: ${{ secrets.PROJECT_ID }} | |
GAR_LOCATION: ${{ secrets.ARTIFACT_REGISTRY_LOCATION }} | |
SERVICE: ${{ secrets.ATTENDEE_SERVICE_CLOUD_RUN_NAME }} | |
REGION: ${{ secrets.ATTENDEE_SERVICE_CLOUD_RUN_LOCATION }} | |
jobs: | |
deploy: | |
# Add 'id-token' with the intended permissions for workload identity federation | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Google Auth | |
id: auth | |
uses: 'google-github-actions/auth@v2' | |
with: | |
token_format: 'access_token' | |
workload_identity_provider: '${{ secrets.WIF_PROVIDER }}' | |
service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}' | |
# Authenticate Docker to Google Cloud Artifact Registry | |
- name: Docker Auth | |
id: docker-auth | |
uses: 'docker/login-action@v1' | |
with: | |
username: 'oauth2accesstoken' | |
password: '${{ steps.auth.outputs.access_token }}' | |
registry: '${{ env.GAR_LOCATION }}-docker.pkg.dev' | |
- name: Build and Push Container | |
working-directory: ./backend/services/attendee-service | |
run: |- | |
docker build --build-arg DEVELOPMENT_MODE="${{ secrets.DEVELOPMENT_MODE }}" --build-arg MONGO_DB_CONNECTION_URL="${{ secrets.MONGO_DB_CONNECTION_URL }}" --build-arg MONGO_DB_NAME="${{ secrets.MONGO_DB_NAME }}" --build-arg AUTHORIZATION_TOKEN_PRIVATE_KEY="${{ secrets.AUTHORIZATION_TOKEN_PRIVATE_KEY }}" --build-arg REFRESH_TOKEN_PRIVATE_KEY="${{ secrets.REFRESH_TOKEN_PRIVATE_KEY }}" --build-arg AUTHORIZATION_TOKEN_KEY_ID="${{ secrets.AUTHORIZATION_TOKEN_KEY_ID }}" --build-arg REFRESH_TOKEN_KEY_ID="${{ secrets.REFRESH_TOKEN_KEY_ID }}" --build-arg API_AUDIENCE="${{ secrets.API_AUDIENCE }}" --build-arg CREDENTIALS_AUTHORITY="${{ secrets.CREDENTIALS_AUTHORITY }}" --build-arg CREDENTIALS_REALM="${{ secrets.CREDENTIALS_REALM }}" -t "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.SERVICE }}:${{ github.sha }}" ./ | |
docker push "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.SERVICE }}:${{ github.sha }}" | |
- name: Deploy to Cloud Run | |
id: deploy | |
uses: google-github-actions/deploy-cloudrun@v2 | |
with: | |
service: ${{ env.SERVICE }} | |
region: ${{ env.REGION }} | |
image: ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.SERVICE }}:${{ github.sha }} | |
flags: '--port 8082' |