Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(pypi): publish git-cliff on PyPI #158

Merged
merged 14 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/.git/
/.github/
/npm/
/pypi/
/website/

# Files
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,83 +39,95 @@ jobs:
TOOLCHAIN: stable,
TARGET: x86_64-unknown-linux-gnu,
NPM_PUBLISH: true,
PYPI_PUBLISH: true,
}
- {
NAME: linux-x64-musl,
OS: ubuntu-22.04,
TOOLCHAIN: stable,
TARGET: x86_64-unknown-linux-musl,
NPM_PUBLISH: false,
PYPI_PUBLISH: true,
}
- {
NAME: linux-x86-glibc,
OS: ubuntu-22.04,
TOOLCHAIN: stable,
TARGET: i686-unknown-linux-gnu,
NPM_PUBLISH: false,
PYPI_PUBLISH: true,
}
- {
NAME: linux-x86-musl,
OS: ubuntu-22.04,
TOOLCHAIN: stable,
TARGET: i686-unknown-linux-musl,
NPM_PUBLISH: false,
PYPI_PUBLISH: true,
}
- {
NAME: linux-arm64-glibc,
OS: ubuntu-22.04,
TOOLCHAIN: stable,
TARGET: aarch64-unknown-linux-gnu,
NPM_PUBLISH: true,
PYPI_PUBLISH: true,
}
- {
NAME: linux-arm64-musl,
OS: ubuntu-22.04,
TOOLCHAIN: stable,
TARGET: aarch64-unknown-linux-musl,
NPM_PUBLISH: false,
PYPI_PUBLISH: true,
}
- {
NAME: win32-x64-mingw,
OS: windows-2022,
TOOLCHAIN: stable,
TARGET: x86_64-pc-windows-gnu,
NPM_PUBLISH: false,
PYPI_PUBLISH: true,
}
- {
NAME: win32-x64-msvc,
OS: windows-2022,
TOOLCHAIN: stable,
TARGET: x86_64-pc-windows-msvc,
NPM_PUBLISH: true,
PYPI_PUBLISH: true,
}
- {
NAME: win32-x86-msvc,
OS: windows-2022,
TOOLCHAIN: stable,
TARGET: i686-pc-windows-msvc,
NPM_PUBLISH: false,
PYPI_PUBLISH: true,
}
- {
NAME: win32-arm64-msvc,
OS: windows-2022,
TOOLCHAIN: stable,
TARGET: aarch64-pc-windows-msvc,
NPM_PUBLISH: true,
PYPI_PUBLISH: true,
}
- {
NAME: darwin-x64,
OS: macos-12,
TOOLCHAIN: stable,
TARGET: x86_64-apple-darwin,
NPM_PUBLISH: true,
PYPI_PUBLISH: true,
}
- {
NAME: darwin-arm64,
OS: macos-12,
TOOLCHAIN: stable,
TARGET: aarch64-apple-darwin,
NPM_PUBLISH: true,
PYPI_PUBLISH: true,
}
steps:
- name: Checkout
Expand Down Expand Up @@ -228,6 +240,40 @@ jobs:
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Build Python wheels (linux)
if: matrix.build.PYPI_PUBLISH == true && startsWith(matrix.build.NAME, 'linux')
uses: PyO3/maturin-action@v1
with:
working-directory: pypi
target: ${{ matrix.build.TARGET }}
args: --release --sdist --out wheels
sccache: 'true'
manylinux: auto
orhun marked this conversation as resolved.
Show resolved Hide resolved
- name: Build Python wheels (macos & windows)
if: |
matrix.build.PYPI_PUBLISH == true &&
(startsWith(matrix.build.OS, 'macos') || startsWith(matrix.build.OS, 'windows'))
uses: PyO3/maturin-action@v1
with:
working-directory: pypi
target: ${{ matrix.build.TARGET }}
args: --release --sdist --out wheels
sccache: 'true'
- name: Build Python wheels (musl)
if: matrix.build.PYPI_PUBLISH == true && endsWith(matrix.build.OS, 'musl')
uses: PyO3/maturin-action@v1
with:
working-directory: pypi
target: ${{ matrix.build.TARGET }}
args: --release --sdist --out wheels
sccache: 'true'
manylinux: musllinux_1_2
- name: Upload Python wheels
uses: actions/upload-artifact@v3
with:
working-directory: pypi
name: wheels
path: pypi/wheels

publish-npm:
name: Publish the base package to NPM
Expand All @@ -252,6 +298,24 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

publish-pypi:
name: Publish PyPI package
runs-on: ubuntu-22.04
needs: publish-binaries
steps:
- uses: actions/download-artifact@v3
with:
path: pypi/wheels
name: wheels
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ vars.USE_TESTPYPI == 'true' && secrets.TESTPYPI_API_TOKEN || secrets.PYPI_API_TOKEN }}
MATURIN_REPOSITORY: ${{ vars.USE_TESTPYPI == 'true' && 'testpypi' || 'pypi' }}
with:
command: upload
args: --skip-existing pypi/wheels/*

publish-deb:
name: Publish Debian package
needs: generate-changelog
Expand Down
3 changes: 3 additions & 0 deletions git-cliff/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,6 @@ pretty_assertions = "1.4.0"
pkg-url = "{ repo }/releases/download/v{ version }/{ name }-{ version }-{ target }{ archive-suffix }"
bin-dir = "{ name }-{ version }/{ bin }{ binary-ext }"
pkg-fmt = "tgz"

[package.metadata.maturin]
name = "git-cliff"
18 changes: 18 additions & 0 deletions pypi/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[build-system]
requires = ["maturin>=0.14,<0.15"]
build-backend = "maturin"

[project]
name = "git-cliff"
requires-python = ">=3.7"
classifiers = [
"Intended Audience :: Developers",
"Topic :: Software Development",
"Programming Language :: Rust",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]

[tool.maturin]
bindings = "bin"
manifest-path = "../git-cliff/Cargo.toml"
7 changes: 7 additions & 0 deletions website/docs/installation/pypi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# PyPI

If you are a Python user, you can install and run **git-cliff** from [PyPI](https://pypi.org/project/git-cliff/) using `pip`:

```bash
pip install git-cliff
```