diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml index 4e338b72..39bbf59d 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/cicd.yaml @@ -49,6 +49,8 @@ on: - "**" schedule: - cron: "24 7 */7 * *" + release: + types: [created] concurrency: group: CICD-${{ github.ref }} @@ -160,7 +162,11 @@ jobs: ## a regular commit/push. ## UploadTestPyPI: - if: success() && github.actor == 'btschwertfeger' && github.ref == 'refs/heads/master' + if: | + success() && + github.actor == 'btschwertfeger' && + github.ref == 'refs/heads/master' && + github.event_name == 'push' needs: - Test-Spot-Public - Test-Spot-Private @@ -173,11 +179,30 @@ jobs: secrets: API_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }} + ## =========================================================================== + ## Upload the python-kraken-sdk to Production PyPI + ## + UploadPyPI: + if: | + success() && + github.actor == 'btschwertfeger' && + github.event_name == 'release' + needs: [UploadTestPyPI] + name: Upload the current release to PyPI + uses: ./.github/workflows/_pypi_publish.yaml + with: + REPOSITORY_URL: https://upload.pypi.org/legacy/ + secrets: + API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} + ## =========================================================================== ## Generates and uploads the coverage statistics to codecov ## CodeCov: - if: success() && github.actor == 'btschwertfeger' + if: | + success() && + github.actor == 'btschwertfeger' && + github.event_name == 'push' needs: - Test-Spot-Public - Test-Spot-Private diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index 0641c1ef..00000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,144 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2023 Benjamin Thomas Schwertfeger -# GitHub: https://github.com/btschwertfeger -# -# Workflow that gets triggered, when a release was created in the -# GitHub UI. This enables the upload of the python-kraken-sdk -# for the latest tag to PyPI. -# - -name: PyPI Production Release - -on: - release: - types: [created] - -jobs: - ## =========================================================================== - ## Run pre-commit - just to make sure that the code is still - ## in the proper format - ## - Pre-Commit: - uses: ./.github/workflows/_pre_commit.yaml - - ## =========================================================================== - ## Discover vulnerabilities - ## - CodeQL: - uses: ./.github/workflows/_codeql.yaml - - ## =========================================================================== - ## Build the package - for all Python versions - ## - Build: - uses: ./.github/workflows/_build.yaml - needs: [Pre-Commit] - strategy: - fail-fast: true - matrix: - os: [macos-latest, ubuntu-latest, windows-latest] - python-version: ["3.11"] - with: - os: ${{ matrix.os }} - python-version: ${{ matrix.python-version }} - - ## =========================================================================== - ## Build the documentation - ## - Build-Doc: - needs: [Pre-Commit] - uses: ./.github/workflows/_build_doc.yaml - with: - os: "ubuntu-latest" - python-version: "3.11" - - ## =========================================================================== - ## Run the Spot tests - ## - ## (public endpoints) - ## - Test-Spot-Public: - needs: [Build] - uses: ./.github/workflows/_test_spot_public.yaml - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest] - python-version: ["3.11"] - with: - os: ${{ matrix.os }} - python-version: ${{ matrix.python-version }} - ## - ## (private endpoints) - Test-Spot-Private: - needs: [Build] - uses: ./.github/workflows/_test_spot_private.yaml - strategy: - max-parallel: 1 # to avoid failing tests because of API Rate limits - fail-fast: false - matrix: - os: [ubuntu-latest] - python-version: ["3.11"] - with: - os: ${{ matrix.os }} - python-version: ${{ matrix.python-version }} - secrets: inherit - - ## =========================================================================== - ## Run the Futures tests - ## - ## (public endpoints) - Test-Futures-Public: - needs: [Build] - uses: ./.github/workflows/_test_futures_public.yaml - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest] - python-version: ["3.11"] - with: - os: ${{ matrix.os }} - python-version: ${{ matrix.python-version }} - ## - ## (private endpoints) - Test-Futures-Private: - needs: [Build] - uses: ./.github/workflows/_test_futures_private.yaml - strategy: - max-parallel: 1 # to avoid failing tests because of API Rate limits - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest] - python-version: ["3.11"] - with: - os: ${{ matrix.os }} - python-version: ${{ matrix.python-version }} - secrets: inherit - - ## =========================================================================== - ## Upload the python-kraken-sdk to Test PyPI - ## - UploadTestPyPI: - needs: - - Test-Spot-Public - - Test-Spot-Private - - Test-Futures-Public - - Test-Futures-Private - name: Upload the current release to Test PyPI - uses: ./.github/workflows/_pypi_publish.yaml - with: - REPOSITORY_URL: https://test.pypi.org/legacy/ - secrets: - API_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }} - - ## =========================================================================== - ## Upload the python-kraken-sdk to Production PyPI - ## - UploadPyPI: - needs: [UploadTestPyPI] - name: Upload the current release to PyPI - uses: ./.github/workflows/_pypi_publish.yaml - with: - REPOSITORY_URL: https://upload.pypi.org/legacy/ - secrets: - API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}