2020-05-04 07:10:09 +00:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ master ]
|
|
|
|
pull_request:
|
|
|
|
branches: [ master ]
|
|
|
|
|
|
|
|
jobs:
|
2020-07-15 20:26:14 +00:00
|
|
|
|
2020-05-04 07:10:09 +00:00
|
|
|
build:
|
2020-07-15 20:26:14 +00:00
|
|
|
|
2020-05-04 07:10:09 +00:00
|
|
|
runs-on: ubuntu-latest
|
2020-05-04 07:21:44 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2020-05-20 06:07:58 +00:00
|
|
|
python-version: [3.8]
|
2020-05-04 07:10:09 +00:00
|
|
|
|
|
|
|
steps:
|
2020-07-15 20:26:14 +00:00
|
|
|
|
2020-05-04 07:10:09 +00:00
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
2020-05-04 07:21:44 +00:00
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
|
|
uses: actions/setup-python@v1
|
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
|
2020-05-19 21:03:54 +00:00
|
|
|
- name: Install tools
|
2020-05-04 07:21:44 +00:00
|
|
|
run: |
|
2021-04-23 17:49:22 +00:00
|
|
|
pip install poetry && poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi
|
2020-06-08 19:55:33 +00:00
|
|
|
|
2020-07-15 20:26:14 +00:00
|
|
|
- name: Check formatting and run linters
|
2020-05-19 21:03:54 +00:00
|
|
|
run: |
|
2020-07-15 20:26:14 +00:00
|
|
|
sh check.sh
|
2021-04-26 18:26:21 +00:00
|
|
|
|
|
|
|
- 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
|