diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index a6271a0..3eae1d0 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -17,6 +17,8 @@ jobs: strategy: matrix: python-version: ['3.9'] + outputs: + version: ${{ steps.get_version.outputs.version }} steps: - uses: actions/checkout@v4 @@ -26,6 +28,16 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + + # Get the version from pyproject.toml + - name: Install toml package + run: pip install toml + - name: Get version from pyproject.toml + id: get_version + run: | + VERSION=$(python -c "import toml; print(toml.load('pyproject.toml')['tool']['poetry']['version'])") + echo "version=$VERSION" >> $GITHUB_OUTPUT + - name: Install dependencies run: | python -m pip install poetry diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0433d27..288b48f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,11 +12,27 @@ jobs: build-and-test: uses: ./.github/workflows/build-and-test.yml + create-tag: + name: Create Git Tag + needs: build-and-test + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Create Git Tag + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VERSION: ${{ needs.build-and-test.outputs.version }} + run: | + git config --global user.name 'github-actions' + git config --global user.email 'github-actions@github.com' + git tag "v${VERSION}" + git push origin "v${VERSION}" publish-to-pypi: name: Publish to PyPI - needs: - - build-and-test + needs: [build-and-test, create-tag] runs-on: ubuntu-latest environment: name: pypi @@ -35,11 +51,8 @@ jobs: github-release: - name: >- - Sign the Python 🐍 distribution 📦 with Sigstore - and upload them to GitHub Release - needs: - - build-and-test + name: Sign distribution and create GitHub release + needs: [build-and-test, create-tag] runs-on: ubuntu-latest permissions: @@ -52,27 +65,32 @@ jobs: with: name: build-artifacts path: dist/ + - name: Sign the dists with Sigstore uses: sigstore/gh-action-sigstore-python@v2.1.1 with: inputs: >- ./dist/*.tar.gz ./dist/*.whl + - name: Create GitHub Release env: GITHUB_TOKEN: ${{ github.token }} + VERSION: ${{ needs.build-and-test.outputs.version }} run: >- gh release create - '${{ github.ref_name }}' + "v${VERSION}" --repo '${{ github.repository }}' --notes "" + - name: Upload artifact signatures to GitHub Release env: GITHUB_TOKEN: ${{ github.token }} + VERSION: ${{ needs.build-and-test.outputs.version }} # Upload to GitHub Release using the `gh` CLI. # `dist/` contains the built packages, and the # sigstore-produced signatures and certificates. run: >- gh release upload - '${{ github.ref_name }}' dist/** + "v${VERSION}" dist/** --repo '${{ github.repository }}' diff --git a/pyproject.toml b/pyproject.toml index dbf05df..5a316ab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "paradigma" -version = "0.1.2" +version = "0.1.3" description = "Digital Biomarkers for Parkinson's Disease Toolbox" authors = ["Radboud, eScience Center"] license = "Apache-2.0"