Skip to content

Commit

Permalink
docs: prepping docs and actions for initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
seandstewart committed Sep 4, 2024
1 parent 11b408a commit 6116e20
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/.build-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ jobs:
- name: Store dist artifacts
uses: actions/upload-artifact@v4
with:
name: typelib-dist
name: python-package-distributions
path: dist
23 changes: 17 additions & 6 deletions .github/workflows/changelog.yml → .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
name: Make Changelog
name: Make Documentation

on:
push:
branches:
- "main"
branches: ["main"]
tags: ["*"]

env:
GIT_COMMITTER_NAME: "github-actions[bot]"
GIT_COMMITTER_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"

defaults:
run:
shell: bash

permissions:
contents: write

jobs:
changelog:
documentation:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
python-version: [ "3.9" ]
python-version: [ "3.x" ]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/bootstrap-environ
Expand All @@ -25,4 +32,8 @@ jobs:
python-version: ${{ matrix.python-version }}
runner: ${{ matrix.os }}
- name: Update the Changelog
run: make changelog
run: |
make changelog
git push origin ${{ github.ref_name }}
- name: Build the Docs
run: make docs
76 changes: 41 additions & 35 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ name: Publish Release

on:
push:
tags:
- '*'
tags: ['*']

defaults:
run:
Expand Down Expand Up @@ -41,49 +40,56 @@ jobs:
- name: Store dist artifacts
uses: actions/upload-artifact@v4
with:
name: typelib-dist
name: python-package-distributions
path: dist

publish-pypi:
runs-on: ${{ matrix.os }}
needs: [ build-wheels, build-sdist ]
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
python-version: [ "3.9" ]
publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
needs:
- build-wheels
- build-sdist
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/typelib
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/bootstrap-environ
id: bootstrap-environ
with:
python-version: ${{ matrix.python-version }}
runner: ubuntu-latest
- name: Download distribution artifact
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: typelib-dist
path: dist
- name: Publish to PyPI
run: poetry publish -u $PYPI_USERNAME -p $PYPI_PASSWORD
env:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

create-release:
needs: [ build-wheels, build-sdist ]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
python-version: [ "3.9" ]
name: >-
Sign the Python 🐍 distribution 📦 with Sigstore
and upload them to GitHub Release
needs:
- publish-to-pypi
runs-on: ubuntu-latest
permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore

steps:
- name: Download distribution artifact
- uses: actions/checkout@v4
- uses: ./.github/actions/bootstrap-environ
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: typelib-dist
path: dist
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Compile Release Notes
run: make release-notes > release-notes.md
- name: Report Version
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ defaults:
run:
shell: bash

env:
GIT_COMMITTER_NAME: "github-actions[bot]"
GIT_COMMITTER_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"

jobs:
create-version:
runs-on: ${{ matrix.os }}
Expand All @@ -34,12 +38,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
runner: ${{ matrix.os }}
# In order to make a commit, we need to initialize a user.
- name: Initialize mandatory git config
run: |
git config user.name "GitHub actions"
git config user.email [email protected]
- name: Tag New Version
run: make release-version rule=${{ inputs.level }}
- name: Push New Version
run: git push --follow-tags origin ${{ github.ref_name}}
run: git push --follow-tags origin ${{ github.ref_name }}
16 changes: 15 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,23 @@ release-version: ## Bump the version for this package.


report-version: ## Show the current version of this library.
@poetry version -s
@$(VERSION_CMD)
.PHONY: report-version

docs-version: ## Show the current version of this library as applicable for documentation.
@$(VERSION_CMD) | $(SED_CMD) $(DOCS_FILTER)
.PHONY: docs-version

docs: ## Build the versioned documentation
@mike deploy -u --push $(version) $(alias)
.PHONY: docs

VERSION_CMD ?= poetry version -s
SED_CMD ?= sed -En
DOCS_FILTER ?= 's/^([[:digit:]]+.[[:digit:]]+).*$$/v\1/p'
version ?= $(shell $(VERSION_CMD) | $(SED_CMD) $(DOCS_FILTER))
alias ?= latest

changelog: ## Compile the latest changelog for the current branch.
@git changelog
@git add CHANGELOG.md
Expand Down
18 changes: 9 additions & 9 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#file: noinspection YAMLSchemaValidation
site_name: typelib
site_url: https://pages.github.io/python-typelib
site_url: https://pages.github.io/python-typelib/
repo_name: seandstewart/python-typelib
repo_url: https://github.com/seandstewart/python-typelib
watch: [mkdocs.yml, CHANGELOG.md, src/typelib, docs]
Expand All @@ -19,13 +19,19 @@ theme:
- content.code.select
- content.code.copy
- content.code.annotate

extra:
version:
provider: mike
default: latest
alias: true

palette:
# Palette toggle for automatic mode
- media: "(prefers-color-scheme)"
toggle:
icon: material/brightness-auto
name: Switch to light mode

# Palette toggle for light mode
- media: "(prefers-color-scheme: light)"
scheme: default
Expand All @@ -34,7 +40,6 @@ theme:
toggle:
icon: material/brightness-7
name: Switch to dark mode

# Palette toggle for dark mode
- media: "(prefers-color-scheme: dark)"
scheme: slate
Expand All @@ -43,6 +48,7 @@ theme:
toggle:
icon: material/brightness-4
name: Switch to system preference

font:
text: "IBM Plex Mono"
code: "Fira Code"
Expand Down Expand Up @@ -118,9 +124,3 @@ markdown_extensions:
- toc:
permalink: true
permalink_title: Anchor link to this section for reference


extra:
version:
provider: mike

0 comments on commit 6116e20

Please sign in to comment.