diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..de979f7 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,108 @@ +name: Publish ๐Ÿ“ก Python ๐Ÿ distributions ๐Ÿ“ฆ + +on: + push: + tags: + - v* + +jobs: + lint: + name: Lint ๐Ÿงน and Check ๐Ÿง Python ๐Ÿ package ๐Ÿ—‚๏ธ + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup ๐Ÿ› ๏ธ Python ๐Ÿ + uses: actions/setup-python@v5 + with: + python-version: "3.x" + + - name: Install ๐Ÿ› ๏ธ dependencies ๐Ÿ“š + run: | + pip install --upgrade pip + pip install --requirement=requirements-dev.txt + + - name: Lint ๐Ÿงน with Ruff โšก๏ธ + run: ruff check --output-format=github . + + - name: Check ๐Ÿง with mypy ๐Ÿ‘๐Ÿ + run: mypy --package="tml" + + build: + name: Build ๐Ÿ—๏ธ distributions ๐Ÿ“ฆ + needs: [lint] + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup ๐Ÿ› ๏ธ Python ๐Ÿ + uses: actions/setup-python@v5 + with: + python-version: "3.x" + + - name: Build ๐Ÿ—๏ธ a source distribution ๐Ÿ—ƒ๏ธ and a binary wheel ๐Ÿ›ž + run: pipx run build --outdir=distributions + + - name: Upload ๐Ÿ“ค the built distributions ๐Ÿ“ฆ + uses: actions/upload-artifact@v4 + with: + name: distributions + path: distributions/ + + publish-to-pypi: + name: Publish ๐Ÿ“ก Python ๐Ÿ distributions ๐Ÿ“ฆ to PyPI ๐ŸŒ + needs: [build] + runs-on: ubuntu-latest + environment: + name: release + url: https://pypi.org/p/python-tml + permissions: + id-token: write + + steps: + - name: Download ๐Ÿ“ฅ all the distributions ๐Ÿ“ฆ + uses: actions/download-artifact@v4 + with: + pattern: distributions + path: distributions/ + merge-multiple: true + + - name: Publish ๐Ÿ“ก distributions ๐Ÿ“ฆ to PyPI ๐ŸŒ + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: distributions/ + + upload-to-github-release: + name: Upload ๐Ÿ“ค Python ๐Ÿ distributions ๐Ÿ“ฆ to GitHub Release ๐Ÿš€ + needs: [publish-to-pypi] + runs-on: ubuntu-latest + permissions: + id-token: write + contents: write + + steps: + - name: Download ๐Ÿ“ฅ all the distributions ๐Ÿ“ฆ + uses: actions/download-artifact@v4 + with: + pattern: distributions + path: distributions/ + merge-multiple: true + + - name: Sign ๐Ÿ”‘ the distributions ๐Ÿ“ฆ with Sigstore + uses: sigstore/gh-action-sigstore-python@v3.0.0 + with: + inputs: | + distributions/*.tar.gz + distributions/*.whl + + - name: Create ๐Ÿ“‚ GitHub Release ๐Ÿš€ + env: + GITHUB_TOKEN: ${{ github.token }} + run: gh release --repo="${{ github.repository }}" create "${{ github.ref_name }}" + + - name: Upload ๐Ÿ“ค distributions ๐Ÿ“ฆ and signatures ๐Ÿ” to GitHub Release ๐Ÿš€ + env: + GITHUB_TOKEN: ${{ github.token }} + run: gh release --repo="${{ github.repository }}" upload "${{ github.ref_name }}" distributions/** \ No newline at end of file diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml deleted file mode 100644 index c286940..0000000 --- a/.github/workflows/wheels.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: Build - -on: - push: - tags: - - v* - -jobs: - build_wheels: - name: Build wheels - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Build wheels - run: pipx run build --wheel - - - uses: actions/upload-artifact@v3 - with: - path: dist/*.whl - - build_sdist: - name: Build source distribution - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Build sdist - run: pipx run build --sdist - - - uses: actions/upload-artifact@v3 - with: - path: dist/*.tar.gz - - upload_pypi: - needs: [build_wheels, build_sdist] - runs-on: ubuntu-latest - steps: - - uses: actions/download-artifact@v3 - with: - # unpacks default artifact into dist/ - # if `name: artifact` is omitted, the action will create extra parent dir - name: artifact - path: dist - - - uses: pypa/gh-action-pypi-publish@v1.8.11 - with: - user: __token__ - password: ${{ secrets.pypi_password }} - skip-existing: true - - upload_release: - needs: [build_wheels, build_sdist] - runs-on: ubuntu-latest - steps: - - uses: actions/download-artifact@v3 - with: - # unpacks default artifact into dist/ - # if `name: artifact` is omitted, the action will create extra parent dir - name: artifact - path: dist - - - name: Release - uses: softprops/action-gh-release@v1 - with: - files: dist/* \ No newline at end of file