-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically create GitHub Release (#138)
* Create a GitHub Release on pushed version tag * Add build to dev dependencies * Clean up python-versions code in QA workflow * Release workflow publishes to pypi (probably) * Upload man page to release * Fix bug in release workflow * Run actionlint on workflows * Only run actionlint once lol * Fix syntax error in release script * Check out before linting workflows * Use yq to pull release version * Formatting SNAFU in release.yaml * Update dev docs * Full path to man file in release workflow * Dev deps should install build * github release shouldn't need a checkout * Consistent output names
- Loading branch information
Showing
5 changed files
with
141 additions
and
24 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
name: Release | ||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
jobs: | ||
versions: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
python-version: ${{ steps.python-version.outputs.python_version }} | ||
release-version: ${{ steps.release-version.outputs.release_version }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Get latest supported Python version | ||
id: python-version | ||
run: | | ||
CLASSIFIERS="$(yq -p toml -o toml '.project.classifiers[]' pyproject.toml | grep "Programming Language :: Python :: " | grep "\.")" | ||
VERSION="$(echo "${CLASSIFIERS}" | sed -e 's/Programming Language :: Python :: \([0-9.]*\)$/"\1"/g' | tail -n 1)" | ||
echo "python_version=[${VERSION}]" > "${GITHUB_OUTPUT}" | ||
# See: https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions | ||
- name: Get release version | ||
id: release-version | ||
run: | | ||
VERSION="$(yq -p toml -o toml -r '.project.version' pyproject.toml)" | ||
echo "release_version=${VERSION}" >> "${GITHUB_OUTPUT}" | ||
build: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- versions | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ needs.versions.outputs.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "${{ needs.versions.outputs.python-version }}" | ||
- name: Install the world | ||
run: | | ||
python -m pip install --upgrade pip setuptools wheel | ||
pip install -e .[dev] | ||
- name: Build Package Distributions | ||
run: python -m build | ||
- name: Store Package Distributions | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: package-distributions | ||
path: dist/ | ||
- name: Build Man Page | ||
run: sphinx-build -M man docs _build | ||
- name: Store Man Page | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: man-page | ||
path: _build/man | ||
|
||
pypi-release: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/pypi | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Download distributions | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: package-distributions | ||
path: dist/ | ||
- name: Publish release to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
||
github-release: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- versions | ||
- build | ||
steps: | ||
- name: Download distributions | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: package-distributions | ||
path: dist/ | ||
- name: Download man page | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: man-page | ||
path: man | ||
- name: Create a GitHub release | ||
uses: marvinpinto/action-automatic-releases@latest | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
draft: false | ||
prerelease: false | ||
title: Release v${{ needs.versions.outputs.release-version }} | ||
files: | | ||
dist/* | ||
man/pyee.1 |
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
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
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