Skip to content

Commit

Permalink
ci: Automated release workflow
Browse files Browse the repository at this point in the history
To enable automated releases, this:

 - reformats the change log to match what release-please wants/needs
 - rolls back version numbers to match the latest release and tags them, so release-please can update them based on conventional commits
 - fixes a warning in binaries/setup.py about missing long_description_content_type
 - adds config file and manifest for release-please, including an explicit sha1 for the latest release to prevent it from going back too far in commit logs (this line will get removed after the next release)
  • Loading branch information
joeyparrish committed Nov 4, 2024
1 parent 69ee0be commit ee8649d
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 7 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
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

# This uses PyPi's trusted publishing config. It can see and verify that
# the publication request comes from this repo and this exact workflow,
# and this repo and workflow are allow-listed for publication without a
# token.
- name: Publish modules
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
attestations: true
15 changes: 15 additions & 0 deletions .release-please-config.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.5.1"
}
12 changes: 7 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions binaries/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=[
Expand Down
2 changes: 1 addition & 1 deletion binaries/streamer_binaries/__init__.py
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion streamer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = '0.6.0'
__version__ = '0.5.1' # x-release-please-version

from . import controller_node

0 comments on commit ee8649d

Please sign in to comment.