-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (67 loc) · 2.05 KB
/
ci-pipeline.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: CI Pipeline
on:
pull_request:
types: [opened, synchronize]
push:
branches: [main]
jobs:
code-quality:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ["3.12"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install dependencies
run: |
pip install --upgrade pip pylint
pip install .[dev]
- name: check black formating
run: |
black --check --diff --config ./pyproject.toml .
- name: lint changed and added files
run: |
pylint --rcfile=.pylintrc --fail-under 9 shiny_invoice/
build-container:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Log in to registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create Image & Version String
id: image_version
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/shiny_invoice
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
[ "$VERSION" == "main" ] && VERSION=latest
echo "image_id=$IMAGE_ID" >> "GITHUB_OUTPUT"
echo "version=$VERSION" >> "GITHUB_OUTPUT"
echo $IMAGE_ID
echo $VERSION
- name: Build images
uses: docker/build-push-action@v5
env:
IMAGE_ID: ${{ steps.image_version.outputs.image_id }}
VERSION: ${{ steps.image_version.outputs.version }}
with:
context: .
push: true
tags: |
$IMAGE_ID:$VERSION
$IMAGE_ID:latest