Skip to content

Commit

Permalink
COM-12827:
Browse files Browse the repository at this point in the history
-Automate release process completely taking advantage of semantic commits and already-created in GitHub actions
- update version to publish
- Change order authors and maintainers to view only one in PyPi web page (Open request here pypi/warehouse#12877)
- add changelog: false to not update CHANGELOG.md in the CI process
  • Loading branch information
rsanchez87 committed Jan 20, 2025
1 parent d69ddd8 commit 4183d3e
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 157 deletions.
184 changes: 29 additions & 155 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,170 +4,37 @@ name: release

on:
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g., 0.1.0)'
required: true
push:
tags:
- 'v*.*.*'

jobs:
min_linux:
name: linux with min supported deps
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.7
uses: actions/setup-python@v5
with:
python-version: 3.7
- name: Install dependencies
run: |
make install_deps
sudo apt update && sudo apt install \
git \
cmake \
gcc-multilib \
g++-multilib \
gstreamer1.0-tools \
gstreamer1.0-libav \
gstreamer1.0-plugins-bad \
ffmpeg \
vpx-tools \
aom-tools \
wget \
unzip
- name: Check
run: |
make check
- name: Test Build the wheel
run: |
pip wheel .
- name: Build all reference decoders
run: |
make all_reference_decoders
- name: Clean up
run: |
make clean
linux:
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: 3.13
- name: Install dependencies
run: |
make install_deps
sudo apt update && sudo apt install \
git \
cmake \
gcc-multilib \
g++-multilib \
gstreamer1.0-tools \
gstreamer1.0-libav \
gstreamer1.0-plugins-bad \
ffmpeg \
vpx-tools \
aom-tools \
wget \
unzip
- name: Check
run: |
make check
- name: Test Build the wheel
run: |
pip wheel .
- name: Build all reference decoders
run: |
make all_reference_decoders
- name: Clean up
run: |
make clean
windows:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.7
uses: actions/setup-python@v5
with:
python-version: 3.7
- name: Install dependencies
run: |
make install_deps
- name: Check
run: |
make check
- name: Test Build the wheel
run: |
pip wheel .
create_release:
name: Create Release
runs-on: ubuntu-20.04
needs:
- min_linux
- linux
- windows

steps:
- uses: actions/checkout@v4
- name: Determine version
id: get_version
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
VERSION=${{ github.event.inputs.version }}
else
VERSION=${{ github.ref_name }}
VERSION=${VERSION#v}
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Extract release notes from CHANGELOG.md
id: extract_notes
run: |
VERSION=${{ env.VERSION }}
if ! grep -q "## \\[$VERSION\\]" CHANGELOG.md; then
echo "Release notes for version $VERSION not found in CHANGELOG.md"
exit 1
fi
NOTES=$(awk "/## \\[$VERSION\\]/ {flag=1; next} /^## \\[/ {flag=0} flag" CHANGELOG.md | sed '/^$/d')
name: Create Release and Publish
runs-on: ubuntu-latest
concurrency: create_release

echo "NOTES<<EOF" >> $GITHUB_ENV
echo "$NOTES" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Create Git Tag
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
git config user.name "github-actions"
git config user.email "[email protected]"
git tag v${{ env.VERSION }}
git push origin v${{ env.VERSION }}
- name: Create GitHub Release
run: |
VERSION=${{ env.VERSION }}
gh release create v$VERSION \
--title "Release v$VERSION" \
--notes "$NOTES"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish_to_pypi:
name: Publish to PyPI
runs-on: ubuntu-20.04
needs:
- create_release
permissions:
id-token: write
contents: write

steps:
- uses: actions/checkout@v4
- name: Setup | Checkout Repository at workflow sha
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.sha }}
- name: Setup | Force correct release branch on workflow sha
run: |
git checkout -B ${{ github.ref_name }} ${{ github.sha }}
- name: Action | Semantic Version Release
id: release
uses: python-semantic-release/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
git_committer_name: "github-actions"
git_committer_email: "[email protected]"
changelog: false
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
Expand All @@ -177,10 +44,17 @@ jobs:
- name: Install dependencies
run: |
pip install setuptools setuptools-scm wheel build
- name: Build
- name: Build package
run: |
python -m build
- name: Publish
- name: Publish | Upload package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: steps.release.outputs.released == 'true'
with:
password: ${{ secrets.PYPI_TOKEN }}
- name: Publish | Upload to GitHub Release Assets
uses: python-semantic-release/[email protected]
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.release.outputs.tag }}
19 changes: 17 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ build-backend = "setuptools.build_meta"

[project]
name = "fluster-conformance"
version = "0.2.0.0" # TODO: Ensure that version 0.2.0 is marked as the final version in the CI release workflow only when we are certain about deploying a new release. This prevents creating an irreversible history in PyPI, which would block re-uploading the same version.
version = "0.2.0.rc3" # TODO: Ensure that version 0.2.0 is marked as the final version in the CI release workflow only when we are certain about deploying a new release. This prevents creating an irreversible history in PyPI, which would block re-uploading the same version.
authors = [
{name = "Andoni Morales Alastruey", email="[email protected]"},
{name = "Pablo Marcos Oltra"},
# {name = "Pablo Marcos Oltra"}, wait to (https://github.com/pypi/warehouse/issues/12877)
]
maintainers = [
{name = "Michalis Dimopoulos", email="[email protected]"},
Expand Down Expand Up @@ -116,3 +116,18 @@ line-ending = "auto"

[project.scripts]
fluster = "fluster.main:fluster_main"

[tool.semantic_release]
version_source = "file"
version_file = "pyproject.toml"
branch = "COM-12827"
version_pattern = 'version\\s*=\\s*"(.*)"'

[tool.semantic_release.branches.main]
match = "(main|master)"
prerelease = false

[tool.semantic_release.branches.feature]
match = "COM-*"
prerelease = true
prerelease_token = "rc"

0 comments on commit 4183d3e

Please sign in to comment.