diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index af54073..b6cbd0c 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 @@ -64,14 +65,15 @@ jobs: node-version: '18.x' registry-url: 'https://registry.npmjs.org' + - name: Set version + id: set_version + run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV + - name: Copy Readme working-directory: javascript 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=//") sed -i 's/"version": "0.0.0",/"version": "'$VERSION'",/' package.json - rm gradle.properties - name: Install dependencies working-directory: javascript @@ -88,11 +90,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..de53ce2 100644 --- a/python/setup.py +++ b/python/setup.py @@ -1,14 +1,14 @@ from setuptools import setup from pathlib import Path import re +import os + +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"],