Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 323f980

Browse files
committedJun 22, 2024·
added ci
1 parent 3a70dd1 commit 323f980

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed
 

‎.github/workflows/main.yml

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Upload Python Package
10+
11+
on:
12+
release:
13+
types: [published]
14+
push:
15+
branches: [main]
16+
pull_request:
17+
branches: [main]
18+
19+
jobs:
20+
deploy:
21+
if: github.event_name != 'pull_request'
22+
runs-on: ubuntu-latest
23+
permissions:
24+
id-token: write
25+
contents: write
26+
steps:
27+
- uses: actions/checkout@v4
28+
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
29+
if: github.event_name == 'push'
30+
- name: Set up Python
31+
uses: actions/setup-python@v5
32+
with:
33+
python-version: '3.x'
34+
- name: Install dependencies
35+
id: set-version
36+
run: |
37+
VERSION=$(grep version setup.cfg | cut -d= -f2 | tr -d '[:blank:]')
38+
[ $GITHUB_EVENT_NAME == 'push' ] && VERSION+=b && VERSION+=$(($(git tag -l "*$VERSION*" | cut -db -f2 | sort -n | tail -1)+1))
39+
[ $GITHUB_EVENT_NAME == 'release' ] && VERSION=${{ github.event.release.tag_name }} && VERSION=${VERSION/v/}
40+
echo VERSION = $VERSION
41+
sed -ie "s/version = .*/version = $VERSION/" setup.cfg
42+
python -m pip install --upgrade pip
43+
pip install build
44+
echo version=$VERSION >> $GITHUB_OUTPUT
45+
NAME="superset_iris"-${VERSION}-py3-none-any
46+
echo name=$NAME >> $GITHUB_OUTPUT
47+
- name: Install requirements
48+
run: |
49+
pip install -U pip setuptools wheel \
50+
-e .
51+
52+
- name: Build Python package
53+
run: ./scripts/build-dist.sh
54+
- name: Publish package
55+
uses: pypa/gh-action-pypi-publish@release/v1
56+
- name: Create Beta Release
57+
id: create_release
58+
if: github.event_name == 'push'
59+
uses: softprops/action-gh-release@v2
60+
with:
61+
tag_name: v${{ steps.set-version.outputs.version }}
62+
prerelease: ${{ github.event_name != 'release' }}
63+
files: dist/${{ steps.set-version.outputs.name }}.whl
64+
- uses: actions/checkout@v4
65+
if: github.event_name == 'release'
66+
with:
67+
ref: main
68+
- name: Bump version
69+
if: github.event_name == 'release'
70+
run: |
71+
git config --global user.name 'ProjectBot'
72+
git config --global user.email 'bot@users.noreply.github.com'
73+
VERSION=${{ github.event.release.tag_name }} && VERSION=${VERSION/v/}
74+
VERSION=`echo $VERSION | awk -F. '/[0-9]+\./{$NF++;print}' OFS=.`
75+
sed -ie "s/version = .*/version = $VERSION/" setup.cfg
76+
git add setup.cfg
77+
git commit -m 'auto bump version with release'
78+
git push

0 commit comments

Comments
 (0)
Please sign in to comment.