Install packages, actions updates #2
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 web backend | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'web-backend/**' | |
- '.github/workflows/web-backend.yml' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install poetry | |
run: pipx install poetry | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
cache: 'poetry' | |
- name: Install dependencies | |
run: | | |
cd web-backend | |
poetry install | |
- name: Run tests | |
run: | | |
cd web-backend | |
poetry run ruff check | |
build: | |
needs: test | |
if: github.ref == 'refs/heads/main' | |
env: | |
IMAGE: ghcr.io/openinframap/web-backend | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./web-backend | |
file: ./web-backend/Dockerfile | |
push: true | |
tags: | | |
${{ env.IMAGE }}:${{ github.sha }}-${{ github.run_number }} |