mirror of
https://github.com/orhun/git-cliff.git
synced 2024-09-17 10:17:07 +03:00
chore(pypi): publish git-cliff
on PyPI (#158)
* chore(pypi): First shot at PyPi publishing * docs(pypi): Draft docs for install from PyPI * fix(pypi): fix spellig mistake and add missing dependency * chore(pypi): rc1 for pypi publish workflow * docs(pypi): add example for pip install command Also tweaked verbiage a little * fix(docs): remove extra backtick in command example * fix(pypi): fix MATURIN_REPOSITORY definition * chore(pypi): rc2 for pypi publish fixes mistake in use of endsWith and startsWith expression syntax. Thanks https://rhysd.github.io/actionlint/! * chore(pypi): rc3 for pypi publish workflow Changes: - fixes an error with maturin build - makes sure maturin commands are run in directory containing pyproject.toml - manifest path is now specified in pyproject.toml - sdist is now created as a part of the build command * fix(pypi): specify cwd in action arg * fix(pypi): fix various path issues * chore(docker): ignore pypi directory --------- Co-authored-by: Orhun Parmaksız <orhunparmaksiz@gmail.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
parent
9fd1be6dc6
commit
2b7a1efaaf
@ -2,6 +2,7 @@
|
|||||||
/.git/
|
/.git/
|
||||||
/.github/
|
/.github/
|
||||||
/npm/
|
/npm/
|
||||||
|
/pypi/
|
||||||
/website/
|
/website/
|
||||||
|
|
||||||
# Files
|
# Files
|
||||||
|
64
.github/workflows/cd.yml
vendored
64
.github/workflows/cd.yml
vendored
@ -39,6 +39,7 @@ jobs:
|
|||||||
TOOLCHAIN: stable,
|
TOOLCHAIN: stable,
|
||||||
TARGET: x86_64-unknown-linux-gnu,
|
TARGET: x86_64-unknown-linux-gnu,
|
||||||
NPM_PUBLISH: true,
|
NPM_PUBLISH: true,
|
||||||
|
PYPI_PUBLISH: true,
|
||||||
}
|
}
|
||||||
- {
|
- {
|
||||||
NAME: linux-x64-musl,
|
NAME: linux-x64-musl,
|
||||||
@ -46,6 +47,7 @@ jobs:
|
|||||||
TOOLCHAIN: stable,
|
TOOLCHAIN: stable,
|
||||||
TARGET: x86_64-unknown-linux-musl,
|
TARGET: x86_64-unknown-linux-musl,
|
||||||
NPM_PUBLISH: false,
|
NPM_PUBLISH: false,
|
||||||
|
PYPI_PUBLISH: true,
|
||||||
}
|
}
|
||||||
- {
|
- {
|
||||||
NAME: linux-x86-glibc,
|
NAME: linux-x86-glibc,
|
||||||
@ -53,6 +55,7 @@ jobs:
|
|||||||
TOOLCHAIN: stable,
|
TOOLCHAIN: stable,
|
||||||
TARGET: i686-unknown-linux-gnu,
|
TARGET: i686-unknown-linux-gnu,
|
||||||
NPM_PUBLISH: false,
|
NPM_PUBLISH: false,
|
||||||
|
PYPI_PUBLISH: true,
|
||||||
}
|
}
|
||||||
- {
|
- {
|
||||||
NAME: linux-x86-musl,
|
NAME: linux-x86-musl,
|
||||||
@ -60,6 +63,7 @@ jobs:
|
|||||||
TOOLCHAIN: stable,
|
TOOLCHAIN: stable,
|
||||||
TARGET: i686-unknown-linux-musl,
|
TARGET: i686-unknown-linux-musl,
|
||||||
NPM_PUBLISH: false,
|
NPM_PUBLISH: false,
|
||||||
|
PYPI_PUBLISH: true,
|
||||||
}
|
}
|
||||||
- {
|
- {
|
||||||
NAME: linux-arm64-glibc,
|
NAME: linux-arm64-glibc,
|
||||||
@ -67,6 +71,7 @@ jobs:
|
|||||||
TOOLCHAIN: stable,
|
TOOLCHAIN: stable,
|
||||||
TARGET: aarch64-unknown-linux-gnu,
|
TARGET: aarch64-unknown-linux-gnu,
|
||||||
NPM_PUBLISH: true,
|
NPM_PUBLISH: true,
|
||||||
|
PYPI_PUBLISH: true,
|
||||||
}
|
}
|
||||||
- {
|
- {
|
||||||
NAME: linux-arm64-musl,
|
NAME: linux-arm64-musl,
|
||||||
@ -74,6 +79,7 @@ jobs:
|
|||||||
TOOLCHAIN: stable,
|
TOOLCHAIN: stable,
|
||||||
TARGET: aarch64-unknown-linux-musl,
|
TARGET: aarch64-unknown-linux-musl,
|
||||||
NPM_PUBLISH: false,
|
NPM_PUBLISH: false,
|
||||||
|
PYPI_PUBLISH: true,
|
||||||
}
|
}
|
||||||
- {
|
- {
|
||||||
NAME: win32-x64-mingw,
|
NAME: win32-x64-mingw,
|
||||||
@ -81,6 +87,7 @@ jobs:
|
|||||||
TOOLCHAIN: stable,
|
TOOLCHAIN: stable,
|
||||||
TARGET: x86_64-pc-windows-gnu,
|
TARGET: x86_64-pc-windows-gnu,
|
||||||
NPM_PUBLISH: false,
|
NPM_PUBLISH: false,
|
||||||
|
PYPI_PUBLISH: true,
|
||||||
}
|
}
|
||||||
- {
|
- {
|
||||||
NAME: win32-x64-msvc,
|
NAME: win32-x64-msvc,
|
||||||
@ -88,6 +95,7 @@ jobs:
|
|||||||
TOOLCHAIN: stable,
|
TOOLCHAIN: stable,
|
||||||
TARGET: x86_64-pc-windows-msvc,
|
TARGET: x86_64-pc-windows-msvc,
|
||||||
NPM_PUBLISH: true,
|
NPM_PUBLISH: true,
|
||||||
|
PYPI_PUBLISH: true,
|
||||||
}
|
}
|
||||||
- {
|
- {
|
||||||
NAME: win32-x86-msvc,
|
NAME: win32-x86-msvc,
|
||||||
@ -95,6 +103,7 @@ jobs:
|
|||||||
TOOLCHAIN: stable,
|
TOOLCHAIN: stable,
|
||||||
TARGET: i686-pc-windows-msvc,
|
TARGET: i686-pc-windows-msvc,
|
||||||
NPM_PUBLISH: false,
|
NPM_PUBLISH: false,
|
||||||
|
PYPI_PUBLISH: true,
|
||||||
}
|
}
|
||||||
- {
|
- {
|
||||||
NAME: win32-arm64-msvc,
|
NAME: win32-arm64-msvc,
|
||||||
@ -102,6 +111,7 @@ jobs:
|
|||||||
TOOLCHAIN: stable,
|
TOOLCHAIN: stable,
|
||||||
TARGET: aarch64-pc-windows-msvc,
|
TARGET: aarch64-pc-windows-msvc,
|
||||||
NPM_PUBLISH: true,
|
NPM_PUBLISH: true,
|
||||||
|
PYPI_PUBLISH: true,
|
||||||
}
|
}
|
||||||
- {
|
- {
|
||||||
NAME: darwin-x64,
|
NAME: darwin-x64,
|
||||||
@ -109,6 +119,7 @@ jobs:
|
|||||||
TOOLCHAIN: stable,
|
TOOLCHAIN: stable,
|
||||||
TARGET: x86_64-apple-darwin,
|
TARGET: x86_64-apple-darwin,
|
||||||
NPM_PUBLISH: true,
|
NPM_PUBLISH: true,
|
||||||
|
PYPI_PUBLISH: true,
|
||||||
}
|
}
|
||||||
- {
|
- {
|
||||||
NAME: darwin-arm64,
|
NAME: darwin-arm64,
|
||||||
@ -116,6 +127,7 @@ jobs:
|
|||||||
TOOLCHAIN: stable,
|
TOOLCHAIN: stable,
|
||||||
TARGET: aarch64-apple-darwin,
|
TARGET: aarch64-apple-darwin,
|
||||||
NPM_PUBLISH: true,
|
NPM_PUBLISH: true,
|
||||||
|
PYPI_PUBLISH: true,
|
||||||
}
|
}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@ -228,6 +240,40 @@ jobs:
|
|||||||
npm publish --access public
|
npm publish --access public
|
||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
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
|
||||||
|
- 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:
|
publish-npm:
|
||||||
name: Publish the base package to NPM
|
name: Publish the base package to NPM
|
||||||
@ -252,6 +298,24 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
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:
|
publish-deb:
|
||||||
name: Publish Debian package
|
name: Publish Debian package
|
||||||
needs: generate-changelog
|
needs: generate-changelog
|
||||||
|
@ -54,3 +54,6 @@ pretty_assertions = "1.4.0"
|
|||||||
pkg-url = "{ repo }/releases/download/v{ version }/{ name }-{ version }-{ target }{ archive-suffix }"
|
pkg-url = "{ repo }/releases/download/v{ version }/{ name }-{ version }-{ target }{ archive-suffix }"
|
||||||
bin-dir = "{ name }-{ version }/{ bin }{ binary-ext }"
|
bin-dir = "{ name }-{ version }/{ bin }{ binary-ext }"
|
||||||
pkg-fmt = "tgz"
|
pkg-fmt = "tgz"
|
||||||
|
|
||||||
|
[package.metadata.maturin]
|
||||||
|
name = "git-cliff"
|
||||||
|
18
pypi/pyproject.toml
Normal file
18
pypi/pyproject.toml
Normal file
@ -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
website/docs/installation/pypi.md
Normal file
7
website/docs/installation/pypi.md
Normal file
@ -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
|
||||||
|
```
|
Loading…
Reference in New Issue
Block a user