From a558ecdb4ebc458968cb01b1110b29da73511577 Mon Sep 17 00:00:00 2001 From: apoclyps Date: Mon, 6 Nov 2023 23:36:06 +0000 Subject: [PATCH] ci: combines release and publish into a shared workflow --- .github/workflows/publish.yml | 55 ----------------------------------- .github/workflows/release.yml | 44 ++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 55 deletions(-) delete mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 3f4983e..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: publish - -on: - push: - branches: - - main - -# requires explicit permissions to be granted in the workflow settings -permissions: - contents: write - pull-requests: write - -jobs: - - publish: - name: publish - runs-on: ubuntu-latest - # only run when a new release is created - if: ${{ needs.release.outputs.release_created }} - strategy: - fail-fast: true - matrix: - environment: [testpypi, pypi] - environment: ${{ matrix.environment }} - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - - name: Install poetry - uses: snok/install-poetry@v1 - with: - version: 1.6.1 - - - name: Build - run: poetry build - - - name: Publish testpypi - if: ${{ matrix.environment=='testpypi' }} - env: - POETRY_REPOSITORIES_TESTPYPI_URL: https://test.pypi.org/legacy/ - POETRY_HTTP_BASIC_TESTPYPI_USERNAME: __token__ - POETRY_HTTP_BASIC_TESTPYPI_PASSWORD: ${{secrets.TESTPYPI_API_TOKEN}} - run: poetry publish --repository testpypi - - - name: Publish pypi - if: ${{ matrix.environment=='pypi' }} - env: - POETRY_HTTP_BASIC_PYPI_USERNAME: __token__ - POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{secrets.PYPI_API_TOKEN}} - run: poetry publish diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a2429b2..1e8ff24 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,6 +23,7 @@ jobs: with: # https://github.com/google-github-actions/release-please-action#configuration release-type: python + package-name: poetry-plugin-upgrade changelog-types: > [ {"type": "build", "section": "🏗️ Build System", "hidden": true}, @@ -38,3 +39,46 @@ jobs: {"type": "test", "section": "✅ Tests", "hidden": true} ] include-v-in-tag: false + + publish: + name: publish + runs-on: ubuntu-latest + needs: release + # only run when a new release is created + if: ${{ needs.release.outputs.release_created }} + strategy: + fail-fast: true + matrix: + environment: [ testpypi, pypi ] + environment: ${{ matrix.environment }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Install poetry + uses: snok/install-poetry@v1 + with: + version: 1.6.0 + + - name: Build + run: poetry build + + - name: Publish testpypi + if: ${{ matrix.environment=='testpypi' }} + env: + POETRY_REPOSITORIES_TESTPYPI_URL: https://test.pypi.org/legacy/ + POETRY_HTTP_BASIC_TESTPYPI_USERNAME: __token__ + POETRY_HTTP_BASIC_TESTPYPI_PASSWORD: ${{secrets.TESTPYPI_API_TOKEN}} + run: poetry publish --repository testpypi + + - name: Publish pypi + if: ${{ matrix.environment=='pypi' }} + env: + POETRY_HTTP_BASIC_PYPI_USERNAME: __token__ + POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{secrets.PYPI_API_TOKEN}} + run: poetry publish