main #110
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: main | |
on: | |
push: | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
description: 'Run the build with tmate debugging enabled' | |
required: false | |
type: boolean | |
deploy: | |
description: 'Run deploy' | |
required: false | |
type: boolean | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_REPO: acestream-service | |
PORT: 7000 | |
ENTRY: 8000 | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
- name: build | |
run: docker build -t $DOCKER_USERNAME/$DOCKER_REPO . | |
- name: install | |
run: pip install pytest-cov flake8 codecov versioningit | |
- name: run | |
run: docker run -d -e PORT=$PORT -e ENTRY=$ENTRY -p $ENTRY:$PORT $DOCKER_USERNAME/$DOCKER_REPO | |
- name: sleep | |
run: sleep 4 | |
- name: test | |
run: | | |
python -m pytest | |
flake8 *.py | |
- name: Setup tmate session | |
if: ${{ inputs.debug_enabled || | |
failure() }} | |
uses: mxschmitt/action-tmate@v3 | |
- name: deploy | |
if: ${{ startsWith(github.ref, 'refs/tags/') || | |
inputs.deploy }} | |
env: | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
GITHUB_PASSWORD: ${{ secrets.GITHUB_TOKEN }} | |
GITHUB_USERNAME: ${{ github.actor }} | |
GITHUB_REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
run: ./deploy.sh |