From 679e82bb555ad65f555a50276e1c5cbd9bc65eb4 Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Mon, 30 May 2022 15:09:45 -0400 Subject: Combine the CI and packaging workflows. And only run the latter after the former. --- .github/workflows/ci.yml | 36 ++++++++++++++++++++++++++++++++++ .github/workflows/packaging.yml | 43 ----------------------------------------- 2 files changed, 36 insertions(+), 43 deletions(-) delete mode 100644 .github/workflows/packaging.yml (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f9ef1ae..ad885a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -196,3 +196,39 @@ jobs: run: python -m pip install tox - name: Run tox run: python -m tox -e "${{ matrix.python-version.toxenv }}" + + packaging: + needs: ci + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: actions/setup-python@v3 + with: + python-version: "3.10" + - name: Install dependencies + run: python -m pip install build + - name: Create packages + run: python -m build . + - uses: actions/upload-artifact@v3 + with: + name: dist + path: dist + - name: Publish package + if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.pypi_password }} + - name: Create Release Notes + if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + await github.request(`POST /repos/${{ github.repository }}/releases`, { + tag_name: "${{ github.ref }}", + generate_release_notes: true + }); diff --git a/.github/workflows/packaging.yml b/.github/workflows/packaging.yml deleted file mode 100644 index 0b4df27..0000000 --- a/.github/workflows/packaging.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Packaging - -on: - push: - release: - types: [published] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: - python-version: "3.10" - - name: Install dependencies - run: python -m pip install build - - name: Create packages - run: python -m build . - - uses: actions/upload-artifact@v2 - with: - name: dist - path: dist - - name: Publish package - if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@master - with: - user: __token__ - password: ${{ secrets.pypi_password }} - - name: Create Release Notes - if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') - uses: actions/github-script@v6 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - await github.request(`POST /repos/${{ github.repository }}/releases`, { - tag_name: "${{ github.ref }}", - generate_release_notes: true - }); -- cgit v1.2.1