GH-1: Deploy image in CI #17
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: CI | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: pip install .[dev] | |
- name: Install browsers | |
run: playwright install --with-deps chromium | |
- name: Run type check | |
run: mypy schemes | |
- name: Run tests | |
run: pytest | |
- id: auth | |
name: Authenticate with Google Cloud | |
uses: google-github-actions/auth@v1 | |
with: | |
token_format: access_token | |
credentials_json: '${{ secrets.GCP_CREDENTIALS }}' | |
- name: Login to Docker repository | |
uses: docker/login-action@v3 | |
with: | |
registry: europe-west1-docker.pkg.dev | |
username: oauth2accesstoken | |
password: ${{ steps.auth.outputs.access_token }} | |
- name: Build and push image | |
uses: docker/build-push-action@v5 | |
with: | |
tags: europe-west1-docker.pkg.dev/dft-ate-schemes-prt/docker/schemes | |
push: true | |
- name: Deploy image | |
uses: google-github-actions/deploy-cloudrun@v1 | |
with: | |
service: schemes | |
image: europe-west1-docker.pkg.dev/dft-ate-schemes-prt/docker/schemes | |
region: europe-west1 |