Skip to content

feat: enhance target setting handling and validation across component… #227

feat: enhance target setting handling and validation across component…

feat: enhance target setting handling and validation across component… #227

Workflow file for this run

# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Upload Python Package
on:
release:
types: [published]
push:
branches:
- master
paths-ignore:
- 'docs/**'
- 'tests/**'
- 'demo/**'
- '.vscode/**'
- '.github/**'
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v3
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
if: github.event_name == 'push'
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Install dependencies
id: set-version
run: |
VERSION=$(awk -F'"' '/^version = / {print $2; exit}' pyproject.toml)
if [ -z "$VERSION" ]; then
echo "Could not find project version in pyproject.toml" >&2
exit 1
fi
if [ "$GITHUB_EVENT_NAME" = "release" ]; then
VERSION="${{ github.event.release.tag_name }}"
VERSION="${VERSION#v}"
fi
if [ "$GITHUB_EVENT_NAME" = "push" ]; then
LAST_BETA=$(git tag -l "v${VERSION}b*" | awk -F'b' '{print $NF}' | sort -n | tail -1)
VERSION="${VERSION}b$(( ${LAST_BETA:-0} + 1 ))"
fi
sed -i -E "s/^version = \".*\"/version = \"$VERSION\"/" pyproject.toml
python -m pip install --upgrade pip
pip install -U pip setuptools
pip install -r requirements-dev.txt
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
NAME="iris_pex_embedded_python"-${VERSION}-py3-none-any
echo "name=$NAME" >> "$GITHUB_OUTPUT"
- name: Build package
run: ./build-dist.sh
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip_existing: true
- name: Create Beta Release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.set-version.outputs.version }}
prerelease: ${{ github.event_name != 'release' }}
files: dist/${{ steps.set-version.outputs.name }}.whl
- uses: actions/checkout@v3
if: github.event_name == 'release'
with:
ref: master
- name: Bump version
if: github.event_name == 'release'
run: |
git config --global user.name 'ProjectBot'
git config --global user.email 'bot@users.noreply.github.com'
VERSION="${{ github.event.release.tag_name }}"
VERSION="${VERSION#v}"
VERSION=$(echo "$VERSION" | awk -F. '/[0-9]+\./{$NF++; print}' OFS=.)
sed -i -E "s/^version = \".*\"/version = \"$VERSION\"/" pyproject.toml
git add pyproject.toml
git commit -m 'auto bump version with release'
git push