Skip to content

workflow

workflow #22

Workflow file for this run

name: Build
on:
push:
branches:
- main
- stable
- release
tags:
- v*
env:
REGISTRY: bikenow.vkw.tu-dresden.de
IMAGE_NAME: ${{ github.repository }}
jobs:
test:
runs-on: self-hosted
container: python:3.9
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install dependencies
run: poetry install
- name: Run unit tests
run: |
cd backend
poetry run python manage.py test
publish:
runs-on: self-hosted
needs: test
container: docker:latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.NEXUS_DOCKER_PUB_USERNAME }}
password: ${{ secrets.NEXUS_DOCKER_PUB_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
# See: https://github.com/docker/metadata-action
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}