tg/.github/workflows/main.yml
Nameless da1f1d3514
Build docker image in CI (#221)
* Build docker image in CI

* Build docker image on any branch temporarely

* Update github actions

* Update github actions

* Update github actions

* Update github actions

* Update github actions

* Update readme

* Update github actions
2021-04-26 21:26:21 +03:00

46 lines
1.2 KiB
YAML

name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install tools
run: |
pip install poetry && poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi
- name: Check formatting and run linters
run: |
sh check.sh
- name: build and deploy master image to ghcr.io
# if: ${{ github.ref == 'refs/heads/master' }}
env:
PKG_TOKEN: ${{ secrets.PKG_TOKEN }}
USERNAME: ${{ github.actor }}
run: |
git_hash=$(git rev-parse --short "$GITHUB_SHA")
git_branch="$(echo ${GITHUB_REF} | cut -d'/' -f3)"
echo ${PKG_TOKEN} | docker login ghcr.io -u ${USERNAME} --password-stdin
docker build -t ghcr.io/${USERNAME}/tg:${git_branch}-${git_hash} -t ghcr.io/${USERNAME}/tg:latest .
docker push ghcr.io/${USERNAME}/tg:${git_branch}-${git_hash}
docker push ghcr.io/${USERNAME}/tg:latest