Skip to content

Commit e6e0c2d

Browse files
committed
Add CI/CD
1 parent c40bcd7 commit e6e0c2d

File tree

3 files changed

+88
-1
lines changed

3 files changed

+88
-1
lines changed

.cspell.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"colorama",
1414
"cssselect",
1515
"dateutil",
16+
"dists",
1617
"fontawesome",
1718
"fonttools",
1819
"Hideyuki",
@@ -33,10 +34,13 @@
3334
"pygments",
3435
"pymdown",
3536
"pymdownx",
37+
"pypa",
3638
"pyphen",
39+
"pypi",
3740
"pyyaml",
3841
"Roboto",
3942
"sdist",
43+
"Sigstore",
4044
"soupsieve",
4145
"superfences",
4246
"tinycss",
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
2+
3+
on: push
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v4
11+
with:
12+
persist-credentials: false
13+
14+
- name: Install uv
15+
uses: astral-sh/setup-uv@v5
16+
17+
- name: Build the project
18+
run: uv build
19+
20+
publish-to-pypi:
21+
name: >-
22+
Publish Python 🐍 distribution 📦 to PyPI
23+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
24+
needs:
25+
- build
26+
runs-on: ubuntu-latest
27+
environment:
28+
name: pypi
29+
url: https://pypi.org/p/markdown-mermaid-cli # Replace <package-name> with your PyPI project name
30+
permissions:
31+
id-token: write # IMPORTANT: mandatory for trusted publishing
32+
33+
steps:
34+
- name: Download all the dists
35+
uses: actions/download-artifact@v4
36+
with:
37+
name: python-package-distributions
38+
path: dist/
39+
- name: Publish distribution 📦 to PyPI
40+
uses: pypa/gh-action-pypi-publish@release/v1
41+
42+
github-release:
43+
name: >-
44+
Sign the Python 🐍 distribution 📦 with Sigstore
45+
and upload them to GitHub Release
46+
needs:
47+
- publish-to-pypi
48+
runs-on: ubuntu-latest
49+
50+
permissions:
51+
contents: write # IMPORTANT: mandatory for making GitHub Releases
52+
id-token: write # IMPORTANT: mandatory for sigstore
53+
54+
steps:
55+
- name: Download all the dists
56+
uses: actions/download-artifact@v4
57+
with:
58+
name: python-package-distributions
59+
path: dist/
60+
- name: Sign the dists with Sigstore
61+
uses: sigstore/[email protected]
62+
with:
63+
inputs: >-
64+
./dist/*.tar.gz
65+
./dist/*.whl
66+
- name: Create GitHub Release
67+
env:
68+
GITHUB_TOKEN: ${{ github.token }}
69+
run: >-
70+
gh release create
71+
"$GITHUB_REF_NAME"
72+
--repo "$GITHUB_REPOSITORY"
73+
--notes ""
74+
- name: Upload artifact signatures to GitHub Release
75+
env:
76+
GITHUB_TOKEN: ${{ github.token }}
77+
# Upload to GitHub Release using the `gh` CLI.
78+
# `dist/` contains the built packages, and the
79+
# sigstore-produced signatures and certificates.
80+
run: >-
81+
gh release upload
82+
"$GITHUB_REF_NAME" dist/**
83+
--repo "$GITHUB_REPOSITORY"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "markdown-mermaid-cli"
7-
version = "0.1.0"
7+
version = "0.0.1"
88
dependencies = [
99
"markdown>=3.8",
1010
]

0 commit comments

Comments
 (0)