-
Notifications
You must be signed in to change notification settings - Fork 5
33 lines (33 loc) · 1.09 KB
/
build.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
name: Build and push Docker image
on: push
jobs:
build-and-push-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint poetry
poetry install --with dev
- name: Run tests
run: poetry run pytest
- run: docker build . -t hspsh/whohacks
- run: echo "::set-output name=TAG::$(git describe --tags 2>/dev/null)"
name: Check if commit is tagged
id: check-tag
- if: ${{ steps.check-tag.outputs.TAG != '' }}
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- if: ${{ steps.check-tag.outputs.TAG != '' }}
name: Push image
run: |
TAG=${{ steps.check-tag.outputs.TAG }}
docker tag hspsh/whohacks ghcr.io/hspsh/whohacks:$TAG
docker push ghcr.io/hspsh/whohacks:$TAG