Skip to content
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
17 changes: 6 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
name: Rust

on:
push:
branches: [ "main" ]
'on':
pull_request:
branches: [ "main" ]

branches:
- main
- dev
env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -18,17 +15,15 @@ jobs:
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose

lint:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Clippy
run: rustup component add clippy
- name: clippy check
run: cargo clippy

formatting:
formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
151 changes: 79 additions & 72 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,76 +1,83 @@
name: Build & maybe upload PyPI package
'on':
push:
branches:
- main
tags:
- '*'
pull_request:
branches:
- main
release:
types:
- published
workflow_dispatch:
push:
branches:
- main
tags:
- '*'
pull_request:
branches:
- main
release:
types:
- published
workflow_dispatch: null
permissions:
contents: read
id-token: write
contents: read
id-token: write
jobs:
build-package:
name: Build & verify package
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
steps:
- name: checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build wheels with maturin
uses: PyO3/maturin-action@v1
with:
command: build
args: --release --out dist --sdist --verbose
- name: Upload built packages
uses: actions/upload-artifact@v4
with:
name: Packages-${{ matrix.os }}
path: dist

release-test-pypi:
name: Publish in-dev package to test.pypi.org
environment: release-test-pypi
if: github.repository_owner == 'second-ed' && github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: build-package
steps:
- name: Download packages built by build-and-inspect-python-package
uses: actions/download-artifact@v4
with:
pattern: Packages-*
path: dist
merge-multiple: true
- name: Upload package to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

release-pypi:
name: Publish released package to pypi.org
environment: release-pypi
if: github.repository_owner == 'second-ed' && github.event.action == 'published'
runs-on: ubuntu-latest
needs: build-package
steps:
- name: Download packages built by build-and-inspect-python-package
uses: actions/download-artifact@v4
with:
pattern: Packages-*
path: dist
merge-multiple: true
- name: Upload package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
build-package:
name: Build & verify package
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
python-version:
- '3.10'
- '3.11'
- '3.12'
- '3.13'
steps:
- name: checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Build wheels with maturin
uses: PyO3/maturin-action@v1
with:
command: build
args: --release --out dist --sdist --verbose --interpreter python${{ matrix.python-version }}
- name: Upload built packages
uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.os }}-py${{ matrix.python-version }}
path: dist
release-test-pypi:
name: Publish in-dev package to test.pypi.org
environment: release-test-pypi
if: github.repository_owner == 'second-ed' && github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: build-package
steps:
- name: Download packages built by build-and-inspect-python-package
uses: actions/download-artifact@v4
with:
pattern: wheel-*
path: dist
merge-multiple: true
- name: Upload package to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
release-pypi:
name: Publish released package to pypi.org
environment: release-pypi
if: github.repository_owner == 'second-ed' && github.event.action == 'published'
runs-on: ubuntu-latest
needs: build-package
steps:
- name: Download packages built by build-and-inspect-python-package
uses: actions/download-artifact@v4
with:
pattern: wheel-*
path: dist
merge-multiple: true
- name: Upload package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "readme-update"
version = "0.1.1"
version = "0.1.2"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,29 @@ It will update in place if the `# Scripts` block exists or else it will append i
| `example_usage.py` | | |
::

# Some line afterwards
blah blah
# To install the package
```shell
pip install readme-update
```

# Usage
Assuming its is run from this location.
```shell
root/
scripts/
example_script.py
README.md
```

# example_script.py
```python
import readme_update
from pathlib import Path

path = Path(__file__)

readme_update.py_main(
str(path.parent),
str(path.parents[1] / "README.md")
)
```
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "maturin"

[project]
name = "readme-update"
version = "0.1.1"
version = "0.1.2"
readme = "README.md"
requires-python = ">=3.10"
classifiers = [
Expand Down
Loading