-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fully automated release workflow (#7)
* automation experiments * more * fix workflow * fix workflow 2 * fix workflow 3 * fix workflow 4 * fix workflow 5 * fix workflow 6 * removed diag output and updted changelog
- Loading branch information
Showing
9 changed files
with
126 additions
and
83 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 |
---|---|---|
|
@@ -17,6 +17,8 @@ jobs: | |
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags | ||
|
||
- name: Install uv | ||
uses: astral-sh/setup-uv@v2 | ||
|
@@ -30,86 +32,91 @@ jobs: | |
python-version-file: ".python-version" | ||
|
||
- name: Build a binary wheel and a source tarball | ||
run: uv build | ||
run: | | ||
./version.sh | ||
uv build | ||
- name: Store the distribution packages | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
|
||
- name: >- | ||
Publish Python 🐍 distribution 📦 to PyPI | ||
github-release: | ||
name: >- | ||
Sign the Python 🐍 distribution 📦 with Sigstore | ||
and upload them to GitHub Release | ||
needs: | ||
- build | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/tags/') | ||
|
||
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: Create GitHub Release | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
run: >- | ||
gh release create | ||
'${{ github.ref_name }}' | ||
--repo '${{ github.repository }}' | ||
--notes-from-tag '${{ github.ref_name }}' | ||
--draft | ||
- name: Upload artifact signatures to GitHub Release | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | ||
TWINE_REPOSITORY: pypi | ||
# | ||
run: uvx twine upload dist/* | ||
# github-release: | ||
# name: >- | ||
# Sign the Python 🐍 distribution 📦 with Sigstore | ||
# and upload them to GitHub Release | ||
# needs: | ||
# - publish-to-pypi | ||
# runs-on: ubuntu-latest | ||
# | ||
# 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: Create GitHub Release | ||
# env: | ||
# GITHUB_TOKEN: ${{ github.token }} | ||
# run: >- | ||
# gh release create | ||
# '${{ github.ref_name }}' | ||
# --repo '${{ github.repository }}' | ||
# --notes "" | ||
# - 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 }}' | ||
|
||
# publish-to-testpypi: | ||
# name: Publish Python 🐍 distribution 📦 to TestPyPI | ||
# needs: | ||
# - build | ||
# runs-on: ubuntu-latest | ||
# | ||
# environment: | ||
# name: testpypi | ||
# url: https://test.pypi.org/p/<package-name> | ||
# | ||
# permissions: | ||
# id-token: write # IMPORTANT: mandatory for trusted publishing | ||
# | ||
# steps: | ||
# - name: Download all the dists | ||
# uses: actions/download-artifact@v4 | ||
# with: | ||
# name: python-package-distributions | ||
# path: dist/ | ||
# - name: Publish distribution 📦 to TestPyPI | ||
# uses: pypa/gh-action-pypi-publish@release/v1 | ||
# with: | ||
# repository-url: https://test.pypi.org/legacy/ | ||
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 }}' | ||
publish-to-pypi: | ||
name: Publish Python 🐍 distribution 📦 to PyPI | ||
needs: | ||
- build | ||
runs-on: ubuntu-latest | ||
|
||
environment: | ||
name: pypi | ||
url: https://test.pypi.org/p/eve2cml | ||
|
||
# https://docs.pypi.org/trusted-publishers/adding-a-publisher/ | ||
permissions: | ||
id-token: write # IMPORTANT: mandatory for trusted publishing | ||
|
||
steps: | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
|
||
- name: Publish distribution 📦 to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://pypi.org/legacy/ | ||
|
||
# - name: Publish Python 🐍 distribution 📦 to PyPI | ||
# env: | ||
# TWINE_USERNAME: __token__ | ||
# TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | ||
# TWINE_REPOSITORY: pypi | ||
# # | ||
# run: uvx twine upload dist/* |
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 |
---|---|---|
|
@@ -167,6 +167,7 @@ cython_debug/ | |
UNLs/ | ||
ZIPs/ | ||
assets/header.xcf | ||
src/eve2cml/_version.py | ||
|
||
.DS_Store | ||
*.yaml | ||
|
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
.PHONY: build check clean cov covo format mrproper sync test | ||
|
||
build: | ||
$(shell ./version.sh) | ||
uv build | ||
|
||
clean: | ||
|
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 was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,28 @@ | ||
#!/bin/bash | ||
|
||
# Original Git-derived version identifier | ||
version=$(git describe --always --tags --dirty --long) | ||
|
||
# Check if the version contains Git metadata (commits and commit hash) | ||
if [[ "$version" =~ ([0-9]+\.[0-9]+\.[0-9]+)(-([0-9]+)-g([0-9a-f]+)(-dirty)?)? ]]; then | ||
core_version="${BASH_REMATCH[1]}" # 0.1.0 | ||
commit_count="${BASH_REMATCH[3]}" # 1 (optional) | ||
commit_hash="${BASH_REMATCH[4]}" # 281941e (optional) | ||
dirty="${BASH_REMATCH[5]}" # -dirty (optional) | ||
|
||
# If there's no Git metadata, the version is already PEP 440 compliant | ||
if [[ -z "$commit_count" ]]; then | ||
pep440_version="$core_version" | ||
else | ||
# Construct the PEP 440 compliant version | ||
pep440_version="${core_version}+${commit_count}.g${commit_hash}" | ||
|
||
# Append .dirty if the version has '-dirty' | ||
if [[ -n "$dirty" ]]; then | ||
pep440_version="${pep440_version}.dirty" | ||
fi | ||
fi | ||
else | ||
pep440_version="0.0.0+unknown" | ||
fi | ||
echo "__version__ = \"$pep440_version\"" >src/eve2cml/_version.py |