Skip to content

Commit

Permalink
added ci
Browse files Browse the repository at this point in the history
  • Loading branch information
daimor committed Jun 22, 2024
1 parent 3a70dd1 commit c5d0960
Showing 1 changed file with 77 additions and 0 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# 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: [main]
pull_request:
branches: [main]

jobs:
deploy:
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v4
- run: git fetch --depth=1 origin '+refs/tags/*:refs/tags/*' || true
if: github.event_name == 'push'
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
id: set-version
run: |
VERSION=$(grep version setup.cfg | cut -d= -f2 | tr -d '[:blank:]')
[ $GITHUB_EVENT_NAME == 'push' ] && VERSION+=b && VERSION+=$(($(git tag -l "*$VERSION*" | cut -db -f2 | sort -n | tail -1)+1))
[ $GITHUB_EVENT_NAME == 'release' ] && VERSION=${{ github.event.release.tag_name }} && VERSION=${VERSION/v/}
echo VERSION = $VERSION
sed -ie "s/version = .*/version = $VERSION/" setup.cfg
python -m pip install --upgrade pip
pip install build
echo version=$VERSION >> $GITHUB_OUTPUT
NAME="superset_iris"-${VERSION}-py3-none-any
echo name=$NAME >> $GITHUB_OUTPUT
- name: Install requirements
run: |
pip install -U pip setuptools wheel \
-e .
- name: Build Python package
run: python setup.py sdist bdist_wheel
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
- name: Create Beta Release
id: create_release
if: github.event_name == 'push'
uses: softprops/action-gh-release@v2
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@v4
if: github.event_name == 'release'
with:
ref: main
- name: Bump version
if: github.event_name == 'release'
run: |
git config --global user.name 'ProjectBot'
git config --global user.email '[email protected]'
VERSION=${{ github.event.release.tag_name }} && VERSION=${VERSION/v/}
VERSION=`echo $VERSION | awk -F. '/[0-9]+\./{$NF++;print}' OFS=.`
sed -ie "s/version = .*/version = $VERSION/" setup.cfg
git add setup.cfg
git commit -m 'auto bump version with release'
git push

0 comments on commit c5d0960

Please sign in to comment.