53 lines
1.4 KiB
YAML
53 lines
1.4 KiB
YAML
name: Docker
|
|
run-name: Build and Publish Service
|
|
runs-on: ubuntu-latest
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v[0-9]+.[0-9]+.[0-9]+'
|
|
jobs:
|
|
test:
|
|
name: Test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Set up Python 3.10
|
|
uses: https://github.com/actions/setup-python@v3
|
|
with:
|
|
python-version: "3.10"
|
|
architecture: "x64"
|
|
- name: Install Packages
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install flake8 mypy pytest
|
|
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
- name: PEP8 check
|
|
run: flake8 ./code --benchmark
|
|
- name: Type check
|
|
run: mypy ./code
|
|
publish:
|
|
name: Publish
|
|
runs-on: ubuntu-latest
|
|
needs: [test]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
-
|
|
name: Set Environment Variables
|
|
id: vars
|
|
env:
|
|
repository: ${{gitea.repository}}
|
|
ref_name: ${{gitea.ref_name}}
|
|
run: |
|
|
echo $repository
|
|
echo ::set-output name=OWNER::${repository#/*}
|
|
echo ::set-output name=PROJECT::${repository#*/}
|
|
echo $ref_name
|
|
echo ::set-output name=TAG::${ref_name#refs/*/}
|
|
-
|
|
name: Push Image
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: 192.168.1.2:5000/${{gitea.repository}}:${{steps.vars.outputs.TAG}}
|