Skip to content

Commit 5e61c88

Browse files
committed
Switch to pyproject. Trusted deploy flow
1 parent dd28882 commit 5e61c88

File tree

3 files changed

+65
-49
lines changed

3 files changed

+65
-49
lines changed

.github/workflows/build.yml

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1+
name: build
2+
13
on:
24
push:
3-
branches: [ main ]
5+
branches:
6+
- main
7+
- 'dev/**'
48
pull_request:
59
branches: [ main ]
10+
release:
11+
types:
12+
- published
613

14+
# Allows you to run this workflow manually from the Actions tab
15+
workflow_dispatch:
716

817
jobs:
918
lint:
@@ -13,7 +22,7 @@ jobs:
1322
- name: Set up Python
1423
uses: actions/setup-python@v4
1524
with:
16-
python-version: 3.8
25+
python-version: "3.10"
1726

1827
- name: Install dependencies
1928
run: |
@@ -28,42 +37,48 @@ jobs:
2837
pylint --rcfile .pylint.rc rdl_pygments
2938
3039
#-------------------------------------------------------------------------------
31-
build_sdist:
40+
build:
3241
needs:
3342
- lint
34-
name: Build source distribution
43+
name: Build distributions
3544
runs-on: ubuntu-latest
3645
steps:
3746
- uses: actions/checkout@v3
3847

3948
- uses: actions/setup-python@v4
4049
name: Install Python
4150
with:
42-
python-version: 3.8
51+
python-version: "3.10"
52+
53+
- name: Install dependencies
54+
run: |
55+
python -m pip install -U build
4356
44-
- name: Build sdist
45-
run: python setup.py sdist
57+
- name: Build
58+
run: python -m build
4659

4760
- uses: actions/upload-artifact@v3
4861
with:
49-
path: dist/*.tar.gz
62+
path: |
63+
dist/*.tar.gz
64+
dist/*.whl
5065
5166
#-------------------------------------------------------------------------------
5267
deploy:
5368
needs:
54-
- build_sdist
69+
- build
5570

5671
runs-on: ubuntu-latest
72+
environment: release
73+
permissions:
74+
id-token: write
5775

5876
# Only publish when a GitHub Release is created.
59-
if: github.event_name == 'release' && github.event.action == 'published'
77+
if: github.event_name == 'release'
6078
steps:
6179
- uses: actions/download-artifact@v3
6280
with:
6381
name: artifact
6482
path: dist
6583

6684
- uses: pypa/gh-action-pypi-publish@release/v1
67-
with:
68-
user: __token__
69-
password: ${{ secrets.pypi_password }}

pyproject.toml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[build-system]
2+
requires = ["setuptools", "setuptools-scm"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "pygments-systemrdl"
7+
dynamic = ["version"]
8+
9+
authors = [
10+
{name="Alex Mykyta"},
11+
]
12+
description = "SystemRDL 2.0 lexer extension for Pygments"
13+
readme = "README.md"
14+
license = {file = "LICENSE"}
15+
keywords = [
16+
"SystmRDL", "pygments",
17+
]
18+
classifiers = [
19+
"Development Status :: 5 - Production/Stable",
20+
"Programming Language :: Python",
21+
"Programming Language :: Python :: 2",
22+
"Programming Language :: Python :: 3",
23+
"Intended Audience :: Developers",
24+
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
25+
"Operating System :: OS Independent",
26+
]
27+
28+
[project.urls]
29+
Source = "https://github.com/SystemRDL/systemrdl-pygments"
30+
Tracker = "https://github.com/SystemRDL/systemrdl-pygments/issues"
31+
Changelog = "https://github.com/SystemRDL/systemrdl-pygments/releases"
32+
33+
[tool.setuptools.dynamic]
34+
version = {attr = "rdl_pygments.__about__.__version__"}
35+
36+
[project.entry-points."pygments.lexers"]
37+
rdllexer = "rdl_pygments.rdllexer:SystemRDLLexer"

setup.py

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)