main #948
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 | |
streamlink: | |
description: 'Streamlink update indicator' | |
required: false | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_REPO: streamlink-service | |
PORT: 7000 | |
entry: 8000 | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name : checkout | |
run: | | |
curl --location \ | |
--output - \ | |
$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/archive/$GITHUB_REF.tar.gz | | |
tar --strip-components=1 \ | |
--extract \ | |
--gunzip \ | |
- uses: actions/setup-python@v4 | |
- name: GITHUB_REF | |
run: echo GITHUB_REF=$GITHUB_REF github.event.inputs.streamlink=${{ github.event.inputs.streamlink }} | |
- name: build | |
run: docker build -t $DOCKER_USERNAME/$DOCKER_REPO . | |
- uses: codecov/codecov-action@v3 | |
- name: install | |
run: pip install pytest-cov pytest-flake8 versioningit | |
- name: run | |
run: docker run --name streamlink -d -e PORT=$PORT -p $entry:$PORT $DOCKER_USERNAME/$DOCKER_REPO | |
- name: sleep | |
run: sleep 4 | |
- name: test | |
run: | | |
python -m pytest | |
flake8 | |
- name: Setup tmate session | |
if: ${{ inputs.debug_enabled || | |
failure() }} | |
uses: mxschmitt/action-tmate@v3 | |
- name: deploy | |
if: ${{ startsWith(github.ref, 'refs/tags/') || | |
github.event.inputs.streamlink }} | |
env: | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
SHA: ${{ github.event.inputs.streamlink }} | |
run: ./deploy.sh |