diff --git a/.github/workflows/build_docker_images.yml b/.github/workflows/build_docker_images.yml new file mode 100644 index 0000000..26af9c7 --- /dev/null +++ b/.github/workflows/build_docker_images.yml @@ -0,0 +1,75 @@ +name: build docker images + +# Controls when the workflow will run +on: + push: + branches: + - '*' + tags: + - 'v*' + pull_request: + branches: + - '*' + release: + types: [published] + + workflow_dispatch: + +permissions: + contents: read + packages: write + +jobs: + build: + runs-on: ubuntu-latest + steps: + # Get the repository's code + - name: Checkout + uses: actions/checkout@v3 + + # Generate docker tags + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: ghcr.io/dmunozv04/isponsorblocktv, dmunozv04/isponsorblocktv + tags: | + type=raw,value=develop,priority=900,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} + type=ref,enable=true,priority=600,prefix=pr-,suffix=,event=pr + type=ref,event=tag + type=ref,event=branch + type=schedule + + # https://github.com/docker/setup-qemu-action + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + # https://github.com/docker/setup-buildx-action + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to DockerHub + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Login to GHCR + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + platforms: linux/amd64, linux/arm64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=registry,ref=ghcr.io/dmunozv04/isponsorblocktv:buildcache + cache-to: type=registry,ref=ghcr.io/dmunozv04/isponsorblocktv:buildcache,mode=max diff --git a/.github/workflows/release_pypi.yml b/.github/workflows/release_pypi.yml new file mode 100644 index 0000000..b2bea71 --- /dev/null +++ b/.github/workflows/release_pypi.yml @@ -0,0 +1,36 @@ +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Upload Python Package + +on: + release: + types: [published] + +permissions: + contents: read + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.11' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build wheel + - name: Build package + run: python -m build + - name: Publish package + uses: pypa/gh-action-pypi-publish \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..d40904d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,30 @@ +[project] +name = "iSponsorBlockTV" +version = "2.0.3" +authors = [ + {"name" = "dmunozv04"} +] +description = "SponsorBlock client for all YouTube TV clients" +readme = "README.md" +requires-python = ">=3.7" +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "Operating System :: OS Independent", + "Topic :: Home Automation" +] +dynamic = ["dependencies"] + +[tool.hatch.metadata.hooks.requirements_txt] +files = ["requirements.txt"] + +[project.urls] +"Homepage" = "https://github.com/dmunozv04/iSponsorBlockTV" +"Bug Tracker" = "https://github.com/dmunozv04/iSponsorBlockTV/issues" + +[project.scripts] +"iSponsorBlockTV" = "iSponsorBlockTV.__main__:main" + +[build-system] +requires = ["hatchling", "hatch-requirements-txt"] +build-backend = "hatchling.build" \ No newline at end of file