Merge pull request #47 from jamakase/feature/backend-api #13
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: Backend CI workflow | |
on: | |
push: | |
paths: | |
- "services/backend/**" | |
- ".github/workflows/backend.yaml" | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./services/backend | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
# - name: Run tests | |
# run: python -m unittest discover tests | |
build-container: | |
if: github.ref == 'refs/heads/main' | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./services/backend | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Login to Yandex Cloud Container Registry | |
id: login-cr | |
uses: yc-actions/yc-cr-login@v2 | |
with: | |
yc-sa-json-credentials: ${{ secrets.YANDEX_SA_KEY }} | |
- run: | | |
echo "Packaging docker image ..." | |
tag="${DOCKER_REGISTRY}/backend:${{ github.sha }}" | |
docker build -t $tag -t ${DOCKER_REGISTRY}/backend:latest . | |
docker push ${DOCKER_REGISTRY}/backend --all-tags | |
env: | |
DOCKER_REGISTRY: cr.yandex/crpc50gkvq2bp251sfgb |