From 4fdd1b010e13ac20626a0931a450bf143f8975ae Mon Sep 17 00:00:00 2001 From: Joey Parrish Date: Tue, 29 Oct 2024 16:05:41 -0700 Subject: [PATCH] ci: Automated release workflow --- .github/workflows/release-please.yaml | 84 ++++++++++++++++++++++++++ .release-please-config.json | 15 +++++ .release-please-manifest.json | 3 + CHANGELOG.md | 12 ++-- binaries/setup.py | 1 + binaries/streamer_binaries/__init__.py | 2 +- streamer/__init__.py | 2 +- 7 files changed, 112 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/release-please.yaml create mode 100644 .release-please-config.json create mode 100644 .release-please-manifest.json diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml new file mode 100644 index 0000000..def5f25 --- /dev/null +++ b/.github/workflows/release-please.yaml @@ -0,0 +1,84 @@ +name: Release + +on: + push: + branches: + - main + +jobs: + release: + runs-on: ubuntu-latest + outputs: + release_created: ${{ steps.release.outputs.release_created }} + tag_name: ${{ steps.release.outputs.tag_name }} + patch: ${{ steps.release.outputs.patch }} + + steps: + # Create/update release PR + - uses: googleapis/release-please-action@v4 + id: release + with: + # Make sure we create the PR against the correct branch. + target-branch: ${{ github.ref_name }} + # Use a special shaka-bot access token for releases. + token: ${{ secrets.RELEASE_PLEASE_TOKEN }} + # See also settings in these files: + manifest-file: .release-please-manifest.json + config-file: .release-please-config.json + + # The jobs below are all conditional on a release having been created by + # someone merging the release PR. They all run in parallel. + + pypi: + runs-on: ubuntu-latest + needs: release + if: needs.release.outputs.release_created + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Set Python version + uses: actions/setup-python@v5 + with: + python-version: 3.13 + + - name: Install Python deps + run: | + python3 -m pip install -r requirements.txt + python3 -m pip install -r optional_requirements.txt + + - name: Build modules + run: | + # Clean everything. Doesn't matter in a workflow, but if you're + # running this locally... + rm -rf build dist binaries/dist + rm -rf *.egg-info binaries/*.egg-info + rm -f binaries/streamer_binaries/{ffmpeg-*,ffprobe-*,packager-*} + # Build everything. + python3 setup.py sdist bdist_wheel + python3 binaries/build_wheels.py + # Put all the build outputs into one folder for upload together. + cp binaries/dist/* dist/ + + - name: Check modules + run: | + python3 -m twine check --strict dist/* + + - name: Attach modules to the release + uses: svenstaro/upload-release-action@84f3aed82331a2c0c665cf8e9707228f766aba9d + with: + repo_token: ${{ secrets.RELEASE_PLEASE_TOKEN }} + tag: ${{ needs.release.outputs.tag_name }} + file: dist/* + file_glob: true + overwrite: true + + - name: Publish modules + uses: pypa/gh-action-pypi-publish@release/v1 + with: + verbose: true + attestations: true diff --git a/.release-please-config.json b/.release-please-config.json new file mode 100644 index 0000000..7b2a8b1 --- /dev/null +++ b/.release-please-config.json @@ -0,0 +1,15 @@ +{ + "last-release-sha": "a86da1b96c0134ea1e8c2f4f1d33520efe7aa73c", + "packages": { + ".": { + "include-component-in-tag": false, + "include-v-in-tag": true, + "component": "", + "extra-files": [ + "streamer/__init__.py", + "binaries/streamer_binaries/__init__.py" + ], + "release-type": "python" + } + } +} diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..210d290 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.5.1" +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 004c96d..7dd6ec2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,12 @@ -## 0.5.1 (2021-10-14) +# Changelog + +## [0.5.1](https://github.com/shaka-project/shaka-streamer/compare/v0.5.0...v0.5.1) (2021-10-14) - Require Shaka Packager v2.6.1+, to fix segfault in Linux binaries (https://github.com/shaka-project/shaka-packager/issues/996) -## 0.5.0 (2021-10-01) +## [0.5.0](https://github.com/shaka-project/shaka-streamer/compare/v0.4.0...v0.5.0) (2021-10-01) - Command-line argument style changed (dashes instead of underscores) - Multi period support for DASH @@ -39,7 +41,7 @@ (https://github.com/shaka-project/shaka-streamer/pull/95) -## 0.4.0 (2021-08-26) +## [0.4.0](https://github.com/shaka-project/shaka-streamer/compare/v0.3.0...v0.4.0) (2021-08-26) - Fix shutdown of cloud upload - Improve the formatting of minimum version errors @@ -94,7 +96,7 @@ - Fix accidental live-type DASH output in VOD mode -## 0.3.0 (2019-10-18) +## [0.3.0](https://github.com/shaka-project/shaka-streamer/compare/v0.2.0...v0.3.0) (2019-10-18) - Added autodetection of frame rate, resolution, interlacing, track numbers - Added support for custom resolutions and bitrates @@ -125,7 +127,7 @@ (https://github.com/shaka-project/shaka-streamer/issues/36) -## 0.2.0 (2019-10-14) +## [0.2.0](https://github.com/shaka-project/shaka-streamer/compare/v0.1.0...v0.2.0) (2019-10-14) - Comprehensive docs now on GitHub Pages: https://shaka-project.github.io/shaka-streamer/ (https://github.com/shaka-project/shaka-streamer/issues/22) diff --git a/binaries/setup.py b/binaries/setup.py index 79cfee5..5f63c35 100644 --- a/binaries/setup.py +++ b/binaries/setup.py @@ -29,6 +29,7 @@ description='A package containing FFmpeg, FFprobe, and Shaka Packager static builds.', long_description=('An auxiliary package that provides platform-specific' ' binaries used by Shaka Streamer.'), + long_description_content_type='text/plain', url='https://github.com/shaka-project/shaka-streamer/tree/main/binaries', packages=[streamer_binaries.__name__,], classifiers=[ diff --git a/binaries/streamer_binaries/__init__.py b/binaries/streamer_binaries/__init__.py index b509b2c..11b91c3 100644 --- a/binaries/streamer_binaries/__init__.py +++ b/binaries/streamer_binaries/__init__.py @@ -1,7 +1,7 @@ import os import platform -__version__ = '0.6.0' +__version__ = '0.5.1' # x-release-please-version # Get the directory path where this __init__.py file resides. diff --git a/streamer/__init__.py b/streamer/__init__.py index 6a0df12..f088a12 100644 --- a/streamer/__init__.py +++ b/streamer/__init__.py @@ -1,3 +1,3 @@ -__version__ = '0.6.0' +__version__ = '0.5.1' # x-release-please-version from . import controller_node