From 8aa56fe46dea907dca1e54859e4a550506e0b3e1 Mon Sep 17 00:00:00 2001 From: YannC Date: Tue, 3 Dec 2024 17:34:30 +0100 Subject: [PATCH] feat(ci): rework CI + add github release --- .github/workflows/main.yml | 25 +++++++++++++++++++++---- python/setup.py | 9 ++++----- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index af54073..6db5f09 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,10 +21,9 @@ jobs: with: python-version: "3.10" - - name: Copy gradle properties + - name: Copy Readme working-directory: python run: | - curl -s https://raw.githubusercontent.com/kestra-io/kestra/master/gradle.properties > gradle.properties curl -s https://raw.githubusercontent.com/kestra-io/kestra/master/README.md > README.md - name: Install pypa/build @@ -42,6 +41,8 @@ jobs: - name: Build a binary wheel and a source tarball if: startsWith(github.ref, 'refs/tags/v') working-directory: python + env: + VERSION: ${{ github.ref_name }} run: python -m build --sdist --wheel --outdir dist/ . - name: Publish distribution to PyPI @@ -69,7 +70,7 @@ jobs: run: | curl -s https://raw.githubusercontent.com/kestra-io/kestra/master/gradle.properties > gradle.properties curl -s https://raw.githubusercontent.com/kestra-io/kestra/master/README.md > README.md - VERSION=$(cat gradle.properties | grep version= | sed "s/^version=//") + VERSION=${{ github.ref_name#v }} sed -i 's/"version": "0.0.0",/"version": "'$VERSION'",/' package.json rm gradle.properties @@ -88,11 +89,27 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - end: + release: + name: Create GitHub Release runs-on: ubuntu-latest needs: - pip - npm + steps: + - name: Create Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref_name }} + release_name: Release ${{ github.ref_name }} + draft: false + prerelease: false + + end: + runs-on: ubuntu-latest + needs: + - release if: always() env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/python/setup.py b/python/setup.py index 9920167..b1d70ee 100644 --- a/python/setup.py +++ b/python/setup.py @@ -2,13 +2,12 @@ from pathlib import Path import re +version = os.getenv('VERSION', '0.0.0') + setup( name="kestra", - version=re.search( - "(?m)^version=(.*)$", (Path(__file__).parent / "gradle.properties").read_text() - ) - .group(1) - .replace("-SNAPSHOT", ""), + version=version + .replace("v", ""), package_dir={"": "src"}, include_package_data=True, install_requires=["requests"],