Bump Version 0.5.13 #727
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
name: Release on PyPi | |
on: | |
push: | |
branches: | |
- '[0-9]+.[0-9]+' | |
jobs: | |
build: | |
# Any commit message that contains the phrase 'Bump Version' will trigger the release process. | |
# We have an additional safety mechanism in the upload to PyPI step that requires manual approval. | |
# This is to prevent accidental releases. All other steps (eg build, upload to GitHub) are reversible | |
if: ${{ startsWith(github.event.head_commit.message, 'Bump Version') }} | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
id: setup-python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: python -m pip install --upgrade build | |
- name: Build | |
run: | | |
cp -r templates/* superduper/templates/ | |
python -m build | |
# smoke-test that build is valid | |
- name: Check wheel contents | |
run: | | |
python -m pip install check-wheel-contents | |
# check-wheel-contents dist | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ./dist | |
#--------------------------------------------------- | |
# Build GitHub Artifacts | |
#--------------------------------------------------- | |
test-build: | |
needs: ['build'] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
# Artifacts located in artifact/ | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: artifact | |
path: artifact | |
- name: check | |
run: ls -R ./artifact | |
- name: Install wheel | |
run: python -m pip install ./artifact/*.whl | |
- name: Set version for tagging | |
id: set-version | |
run: | | |
export PACKAGE_VERSION=$(python -c "import superduper as s; print(s.__version__)") | |
echo "package_version=${PACKAGE_VERSION}" >> $GITHUB_OUTPUT | |
outputs: | |
package_version: ${{ steps.set-version.outputs.package_version }} | |
#--------------------------------------------------- | |
# Publish GitHub Artifacts | |
#--------------------------------------------------- | |
create-release: | |
needs: ['test-build'] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Configure git identity | |
run: | | |
git config user.email "[email protected]" | |
git config user.name "github-actions" | |
- name: Create git tag | |
run: | | |
TAG="${{ needs.test-build.outputs.package_version }}" | |
git tag -a "$TAG" -m "Release $TAG" | |
git push origin "$TAG" | |
# Artifacts located in artifact/ | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: artifact | |
path: artifact | |
- name: create release | |
run: > | |
gh release create ${{ needs.test-build.outputs.package_version }} | |
--repo ${{ github.repository }} --generate-notes | |
artifact/* | |
env: | |
GH_TOKEN: ${{ github.token }} | |
#--------------------------------------------------- | |
# Publish SuperDuper on Pypi | |
#--------------------------------------------------- | |
publish-pypi: | |
needs: ['create-release'] | |
# Environment waits for approval before attempting to upload to PyPI. | |
# This allows reviewing the files in the release on GitHub. | |
environment: publish-pypi | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: artifact | |
path: artifact | |
# Try uploading to Test PyPI first, in case something fails. | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
packages-dir: artifact/ | |
- name: Remove unwanted files from dist | |
run: rm -f artifact/*.attestation | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
packages-dir: artifact/ |