-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Matthew Watkins <mwatkins@linuxfoundation.org>
- Loading branch information
1 parent
5271f2f
commit c1723d7
Showing
12 changed files
with
2,152 additions
and
1,674 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 |
---|---|---|
@@ -1,27 +1,29 @@ | ||
--- | ||
name: CI | ||
|
||
# yamllint disable-line rule:truthy | ||
on: | ||
push: | ||
branches: [ main ] | ||
branches: [main] | ||
pull_request: | ||
branches: [ main ] | ||
branches: [main] | ||
|
||
jobs: | ||
ci: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.8" | ||
- name: 'Set up Python' | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install tox | ||
- name: 'Install dependencies' | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install tox | ||
- name: Run auto-tests | ||
run: tox | ||
- name: Run auto-tests | ||
run: tox |
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,167 @@ | ||
--- | ||
name: '🐍📦 Production build and release' | ||
|
||
# GitHub/PyPI trusted publisher documentation: | ||
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ | ||
|
||
# yamllint disable-line rule:truthy | ||
on: | ||
# workflow_dispatch: | ||
push: | ||
# Only invoked on release tag pushes | ||
tags: | ||
- v*.*.* | ||
|
||
env: | ||
python-version: '3.10' | ||
|
||
### BUILD ### | ||
|
||
jobs: | ||
build: | ||
name: '🐍 Build packages' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
# IMPORTANT: mandatory for Sigstore | ||
id-token: write | ||
steps: | ||
### BUILDING ### | ||
|
||
- name: 'Checkout repository' | ||
uses: actions/checkout@v4 | ||
|
||
- name: 'Setup PDM for build commands' | ||
uses: pdm-project/setup-pdm@v3 | ||
with: | ||
version: 2.10.0 | ||
|
||
- name: 'Setup Python 3.10' | ||
uses: actions/setup-python@v4.7.0 | ||
with: | ||
python-version: ${{ env.python-version }} | ||
|
||
- name: 'Update version from tags for production release' | ||
run: | | ||
echo "Github versioning: ${{ github.ref_name }}" | ||
scripts/release-versioning.sh | ||
- name: 'Build with PDM backend' | ||
run: | | ||
pdm build | ||
### SIGNING ### | ||
|
||
- name: 'Sign packages with Sigstore' | ||
uses: sigstore/gh-action-sigstore-python@v1.2.3 | ||
with: | ||
inputs: >- | ||
./dist/*.tar.gz | ||
./dist/*.whl | ||
- name: Store the distribution packages | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ github.ref_name }} | ||
path: dist/ | ||
|
||
### PUBLISH GITHUB ### | ||
|
||
github: | ||
name: '📦 Publish to GitHub' | ||
# Only publish on tag pushes | ||
if: startsWith(github.ref, 'refs/tags/') | ||
needs: | ||
- build | ||
runs-on: ubuntu-latest | ||
permissions: | ||
# IMPORTANT: mandatory to publish artefacts | ||
contents: write | ||
steps: | ||
- name: '⬇ Download build artefacts' | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ github.ref_name }} | ||
path: dist/ | ||
|
||
- name: '📦 Publish release to GitHub' | ||
uses: ModeSevenIndustrialSolutions/action-automatic-releases@latest | ||
with: | ||
# Valid inputs are: | ||
# repo_token, automatic_release_tag, draft, prerelease, title, files | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
prerelease: false | ||
automatic_release_tag: ${{ github.ref_name }} | ||
title: ${{ github.ref_name }} | ||
files: | | ||
dist/*.tar.gz | ||
dist/*.whl | ||
### PUBLISH PYPI TEST ### | ||
|
||
testpypi: | ||
name: '📦 Publish to PyPi Test' | ||
# Only publish on tag pushes | ||
if: startsWith(github.ref, 'refs/tags/') | ||
needs: | ||
- build | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: testpypi | ||
permissions: | ||
# IMPORTANT: mandatory for trusted publishing | ||
id-token: write | ||
steps: | ||
- name: '⬇ Download build artefacts' | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ github.ref_name }} | ||
path: dist/ | ||
|
||
- name: 'Remove files unsupported by PyPi' | ||
run: | | ||
if [ -f dist/buildvars.txt ]; then | ||
rm dist/buildvars.txt | ||
fi | ||
rm dist/*.crt dist/*.sig* | ||
- name: Publish distribution to Test PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ | ||
verbose: true | ||
|
||
### PUBLISH PYPI ### | ||
|
||
pypi: | ||
name: '📦 Publish to PyPi' | ||
# Only publish on tag pushes | ||
if: startsWith(github.ref, 'refs/tags/') | ||
needs: | ||
- testpypi | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
permissions: | ||
# IMPORTANT: mandatory for trusted publishing | ||
id-token: write | ||
steps: | ||
- name: '⬇ Download build artefacts' | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ github.ref_name }} | ||
path: dist/ | ||
|
||
- name: 'Remove files unsupported by PyPi' | ||
run: | | ||
if [ -f dist/buildvars.txt ]; then | ||
rm dist/buildvars.txt | ||
fi | ||
rm dist/*.crt dist/*.sig* | ||
- name: 'Setup PDM for build commands' | ||
uses: pdm-project/setup-pdm@v3 | ||
|
||
- name: 'Publish release to PyPI' | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
verbose: true |
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,34 +1,36 @@ | ||
# This workflow will upload a Python package using Twine when a tagged commit is merged. | ||
--- | ||
# This workflow will upload a Python package | ||
# using Twine when a tagged commit is merged. | ||
|
||
name: Publish on PyPI | ||
name: 'Publish on PyPI' | ||
|
||
# yamllint disable-line rule:truthy | ||
on: | ||
push: | ||
tags: | ||
- v* | ||
- v* | ||
|
||
jobs: | ||
deploy: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel twine | ||
- name: Build and publish | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.OSC_PHYSRISK_API_PYPI_TOKEN }} | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
twine upload dist/* | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: 'Install dependencies' | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel twine | ||
- name: 'Build and publish' | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.OSC_PHYSRISK_API_PYPI_TOKEN }} | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
twine upload dist/* |
Oops, something went wrong.