Skip to content

Commit

Permalink
Switch to pyproject. Trusted deploy flow
Browse files Browse the repository at this point in the history
  • Loading branch information
amykyta3 committed Oct 29, 2023
1 parent dd28882 commit 5e61c88
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 49 deletions.
41 changes: 28 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
name: build

on:
push:
branches: [ main ]
branches:
- main
- 'dev/**'
pull_request:
branches: [ main ]
release:
types:
- published

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
lint:
Expand All @@ -13,7 +22,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: "3.10"

- name: Install dependencies
run: |
Expand All @@ -28,42 +37,48 @@ jobs:
pylint --rcfile .pylint.rc rdl_pygments
#-------------------------------------------------------------------------------
build_sdist:
build:
needs:
- lint
name: Build source distribution
name: Build distributions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
name: Install Python
with:
python-version: 3.8
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install -U build
- name: Build sdist
run: python setup.py sdist
- name: Build
run: python -m build

- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
path: |
dist/*.tar.gz
dist/*.whl
#-------------------------------------------------------------------------------
deploy:
needs:
- build_sdist
- build

runs-on: ubuntu-latest
environment: release
permissions:
id-token: write

# Only publish when a GitHub Release is created.
if: github.event_name == 'release' && github.event.action == 'published'
if: github.event_name == 'release'
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_password }}
37 changes: 37 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"

[project]
name = "pygments-systemrdl"
dynamic = ["version"]

authors = [
{name="Alex Mykyta"},
]
description = "SystemRDL 2.0 lexer extension for Pygments"
readme = "README.md"
license = {file = "LICENSE"}
keywords = [
"SystmRDL", "pygments",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 3",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: OS Independent",
]

[project.urls]
Source = "https://github.com/SystemRDL/systemrdl-pygments"
Tracker = "https://github.com/SystemRDL/systemrdl-pygments/issues"
Changelog = "https://github.com/SystemRDL/systemrdl-pygments/releases"

[tool.setuptools.dynamic]
version = {attr = "rdl_pygments.__about__.__version__"}

[project.entry-points."pygments.lexers"]
rdllexer = "rdl_pygments.rdllexer:SystemRDLLexer"
36 changes: 0 additions & 36 deletions setup.py

This file was deleted.

0 comments on commit 5e61c88

Please sign in to comment.