-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update release documentation and prep for automatic releases from git tags
- Loading branch information
Showing
5 changed files
with
190 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
name: Build and upload to PyPI and create GitHub release | ||
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
push: | ||
tags: | ||
- '[0-9]*.[0-9]*.[0-9]*' # Push events to every tag that looks like a semver | ||
- '[0-9]*.[0-9]*.[0-9]*rc[0-9]*' # Push events to every tag that looks like a release candidate | ||
|
||
jobs: | ||
build: | ||
# This job uses vanilla Python tools rather than Poetry, so we don't have to use third party GitHub actions | ||
# e.g. pip, build, twine | ||
# If we even want to, we could switch to using something like actions/setup-poetry (but do a search for current | ||
# best implementations) | ||
name: Build distribution 📦 | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Python 🐍 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Install dependencies | ||
run: python -m pip install build twine | ||
|
||
- name: Build wheel and source distribution | ||
run: | | ||
python -m build | ||
- name: Check README rendering for PyPI | ||
run: twine check dist/* | ||
|
||
# Save ("upload") the distribution artifacts for use by downstream Actions jobs | ||
- name: Upload sdist artifacts 📦 | ||
uses: actions/upload-artifact@v4 # This allows us to persist the dist directory after the job has completed | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
if-no-files-found: error | ||
|
||
publish-to-pypi: | ||
name: Upload release to PyPI | ||
if: startsWith(github.ref, 'refs/tags/') # Belt and suspenders, only ever publish based on a tag | ||
needs: build | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi-publish | ||
url: https://pypi.org/p/space_packet_parser | ||
permissions: | ||
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | ||
|
||
steps: | ||
# This downloads the build artifacts from the build job | ||
- name: Download all the dists 📦 | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
|
||
- name: Publish distribution 📦 to PyPI | ||
uses: pypa/[email protected] | ||
|
||
create-github-release: | ||
name: >- | ||
Sign the Python 🐍 distribution 📦 with Sigstore | ||
and upload them to GitHub Release | ||
needs: | ||
- publish-to-pypi | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi-publish | ||
permissions: | ||
contents: write # IMPORTANT: mandatory for making GitHub Releases | ||
id-token: write # IMPORTANT: mandatory for sigstore | ||
|
||
steps: | ||
- name: Download all the dists 📦 | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
|
||
- name: Sign the dists 📦 with Sigstore 🔑 | ||
uses: sigstore/[email protected] | ||
with: | ||
inputs: >- | ||
./dist/*.tar.gz | ||
./dist/*.whl | ||
- name: Determine if it's a pre-release | ||
# Dynamically sets the --prerelease option passed to the release create CLI based on matching the *rc* | ||
# substring in the git tag. If rc not present, does not pass --prerelease to the CLI. | ||
run: | | ||
if [[ "${{ github.ref_name }}" == *rc* ]]; then | ||
echo "PRE_RELEASE_OPTION=--prerelease" >> $GITHUB_ENV | ||
else | ||
echo "PRE_RELEASE_OPTION=''" >> $GITHUB_ENV | ||
fi | ||
- name: Get latest non-prerelease release | ||
# This fetches the "latest" (non-prerelease) release ref, | ||
# so we can generate release notes from that point instead of the most recent prerelease. | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
run: | | ||
latest_release=$(gh release list --repo "${{ github.repository }}" --limit 100 --json tagName,isPrerelease --jq '.[] | select(.isPrerelease == false) | .tagName' | head -n 1) | ||
if [ -z "$latest_release" ]; then | ||
echo "No non-prerelease release found." | ||
exit 1 | ||
fi | ||
echo "LATEST_RELEASE_TAG=$latest_release" >> $GITHUB_ENV | ||
- name: Create GitHub Release | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
# Uses the GitHub CLI to generate the Release and auto-generate the release notes. Also generates | ||
# the Release title based on the annotation on the git tag. | ||
run: >- | ||
gh release create | ||
'${{ github.ref_name }}' | ||
--repo '${{ github.repository }}' | ||
${{ env.PRE_RELEASE_OPTION }} | ||
--generate-notes | ||
--notes-start-tag '${{ env.LATEST_RELEASE_TAG }}' | ||
- name: Upload artifact 📦 signatures to GitHub Release | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
# Upload to GitHub Release using the `gh` CLI. | ||
# `dist/` contains the built packages, and the | ||
# sigstore-produced signatures and certificates. | ||
run: >- | ||
gh release upload | ||
'${{ github.ref_name }}' dist/** | ||
--repo '${{ github.repository }}' |
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 |
---|---|---|
@@ -1,19 +1,20 @@ | ||
cff-version: 1.2.0 | ||
title: 'space_packet_parser' | ||
type: software | ||
version: '4.2.0' | ||
version: '5.0.0rc6' | ||
description: A CCSDS telemetry packet decoding library based on the XTCE packet format description standard. | ||
license: BSD-3-Clause | ||
abstract: The space_packet_parser Python library is a generalized, configurable packet decoding library for CCSDS telemetry | ||
packets based on the XTCE standard for packet structure definitions. The core functionality of the library is the | ||
configuration of a Parser object by a static XTCE XML document. The configured Parser can then iterate through binary | ||
data, parsing and returning ParsedPacket objects containing the decoded packet field values in a memory efficient | ||
generator pattern. The binary string may originate from an in-memory bit stream, a buffered file reader opened in | ||
binary mode, or a python socket object; in every case, a small buffer is used to read chunks of data to ensure that | ||
memory usage is minimal. The space_packet_parser library supports robust error handling and is capable of skipping malformed | ||
packet structures and unidentified packet structures and can dynamically parse mixed APID packet streams. The | ||
`Parser.generator` object supports keyword arguments for debugging such as the ability to return unraised parsing | ||
errors, which contain partial instances of parsed packet data to aid in debugging. | ||
abstract: The Space Packet Parser Python library is a generalized, configurable packet decoding library for CCSDS telemetry | ||
packets based on the XTCE standard for packet structure definitions. It supports complex and polymorphic | ||
packet structures, using the XTCE UML model to represent dynamic inheritance structures and conditionals | ||
based on previously parsed data fields. The core functionality of the library is the | ||
configuration of an XtcePacketDefinition object from a static XTCE XML document. The configured definition | ||
object can then iterate over binary data, parsing and yielding parsed Packet objects containing the decoded | ||
packet field values in a generator pattern. The binary data may originate from an in-memory binary object, | ||
a buffered file reader opened in binary mode, or a python socket object; in every case, a small buffer is | ||
used to read chunks of data to reduce memory footprint. | ||
The space_packet_parser library supports robust error handling, is capable of handling malformed | ||
packet structures, and can dynamically parse muxed APID packet streams. | ||
authors: | ||
- email: [email protected] | ||
name: Gavin Medley | ||
|
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