Skip to content

Commit

Permalink
skip: updated github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaJack committed Jan 22, 2024
1 parent 4ca2978 commit c3277aa
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 20 deletions.
17 changes: 15 additions & 2 deletions .github/workflows/from_commit_to_lint_test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
# ┌───────────────────────────────────────────────────────────────┐
# │ Contents of from_commit_to_lint_test.yml │
# ├───────────────────────────────────────────────────────────────┘
#
# ├──┐From commit
# │ └── Lint and test
#
# └───────────────────────────────────────────────────────────────

# ################################################################ From commit

name: Lint and test Python package

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

on:
push:
branches: [ "master" ]
Expand All @@ -13,6 +24,8 @@ on:
- '**.py'
branches: [ "master" ]

# ################################ Lint and test

jobs:
test:
name: Lint and test
Expand Down
48 changes: 43 additions & 5 deletions .github/workflows/from_tag_to_build_release_pypi.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,34 @@
name: Create release and deploy to PyPI from a new tag
# ┌───────────────────────────────────────────────────────────────┐
# │ Contents of from_tag_to_build_release_pypi.yml │
# ├───────────────────────────────────────────────────────────────┘
#
# ├──┐From tag
# │ └──┐Build and test
# │ ├── Release to GitHub
# │ └── Deploy to PyPI
#
# └───────────────────────────────────────────────────────────────

# ################################################################ From tag

name: Create GitHub release and deploy to PyPI from a new tag

# requirements: PyPI API token

# debug:
# git push --delete origin v2.1.0 && git tag --delete v2.1.0
# git -a && git commit --amend
# git push --force
# git tag v2.1.0 && git push --tags

on:
push:
tags:
- 'v*'
jobs:

# ################################ Build and test

build:
name: Test and build package
runs-on: ubuntu-latest
Expand All @@ -21,7 +44,7 @@ jobs:
python-version: ["3.12"]
steps:
- name: Access source code
uses: actions/checkout@v4
uses: actions/checkout@master
# needed to list changes
with:
fetch-depth: 0
Expand All @@ -33,6 +56,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build wheel setuptools
python -m pip install -e .
- name: Test package
run: python -m unittest
Expand Down Expand Up @@ -73,16 +97,28 @@ jobs:
name: python-dist
path: dist

# ################ Release to GitHub

release:
name: Create a new release
name: Release to GitHub
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Access package
uses: actions/download-artifact@master
with:
name: python-dist
path: dist
- name: Rename package
run: |
cd "dist"
oldname="$(find -type f -name "*.whl" -print -quit)"
newname="${oldname/tableofcontents/toc}"
cd ..
mkdir gh
cp "dist/$oldname" "gh/$newname"
# https://raw.githubusercontent.com/orhun/git-cliff/main/.github/workflows/cd.yml
- name: Create release
uses: softprops/action-gh-release@master
Expand All @@ -93,9 +129,11 @@ jobs:
token: ${{ github.token }}
fail_on_unmatched_files: true
files: |
dist/*.whl
gh/*.whl
# other file

# ################ Deploy to PyPI

pypi:
name: Deploy to PyPI
needs: build
Expand All @@ -107,7 +145,7 @@ jobs:
name: python-dist
path: dist
- name: Deploy package
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@unstable/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Changelog for toc
# Changelog - toc

## [2.1.0] - 2024-01-22
### Added
Expand Down
23 changes: 11 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@
# │ Contents of pyproject.toml │
# ├───────────────────────────────────────────────────────────────┘
#
# ├── BUILD SYSTEM
# ├── PROJECT
# ├── TOOLS
# ├── Build system
# ├── Project
# ├──┐Tools
# │ └── Git-Cliff
#
# └───────────────────────────────────────────────────────────────

# ################################################################ BUILD SYSTEM
# ################################################################ Build system

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[tool.setuptools.dynamic]
readme = {file = ["README.md", "CHANGELOG.md"]}

# ################################################################ PROJECT
# ################################################################ Project

[project]
name = "tableofcontents"
Expand All @@ -26,8 +24,7 @@ authors = [
{ name="AlphaJack" },
]
description = "Generate a table of contents from the comments of a file"
#readme = "README.md"
dynamic = ["readme"]
readme = "README.md"
requires-python = ">=3.10"
classifiers = [
"Development Status :: 5 - Production/Stable",
Expand All @@ -51,7 +48,9 @@ Issues = "https://github.com/AlphaJack/toc/issues"
Repository = "https://github.com/AlphaJack/toc"
Changelog = "https://github.com/AlphaJack/toc/blob/master/CHANGELOG.md"

# ################################################################ TOOLS
# ################################################################ Tools

# ################################ Git-Cliff

[tool.git-cliff.git]
conventional_commits = false
Expand Down Expand Up @@ -81,7 +80,7 @@ commit_parsers = [

[tool.git-cliff.changelog]
trim = true
header = """# Changelog for toc
header = """# Changelog - toc
"""
body = """
Expand Down

0 comments on commit c3277aa

Please sign in to comment.