minor: updated CHANGELOG.md #33
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ┌───────────────────────────────────────────────────────────────┐ | |
# │ 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 v1.1.0 && git tag --delete v1.1.0 | |
# git -a && git commit --amend | |
# git push --force | |
# git tag v1.1.0 && git push --tags | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
# ################################ Build and test | |
build: | |
name: Test and build package | |
environment: production | |
runs-on: ubuntu-latest | |
# needed to push commit to repo | |
permissions: | |
contents: write | |
outputs: | |
version: ${{ steps.version.outputs.content }} | |
changelog: ${{ steps.changelog.outputs.content }} | |
strategy: | |
fail-fast: true | |
matrix: | |
python-version: ["3.12"] | |
steps: | |
- name: Access source code | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 4.1.1 | |
# needed to list changes | |
with: | |
fetch-depth: 0 | |
token: ${{ github.token }} | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # 5.0.0 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- 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 | |
- name: Store version | |
id: version | |
run: python -m toc.cli --version | |
- name: Store partial changelog for release notes | |
id: changelog | |
uses: orhun/git-cliff-action@8b17108aad4d9362649a5dae020746c2a767c90d # 3.0.2 | |
with: | |
config: pyproject.toml | |
args: -vv --latest --strip all | |
env: | |
OUTPUT: CHANGELOG-PARTIAL.md | |
# generating and committing manually, as it would not appear in final release | |
#- name: Store full changelog for package and repo | |
# id: changelog-full | |
# uses: orhun/git-cliff-action@8b17108aad4d9362649a5dae020746c2a767c90d # 3.0.2 | |
# with: | |
# config: pyproject.toml | |
# args: -vv | |
# env: | |
# OUTPUT: CHANGELOG.md | |
# skipped, You are not currently on a branch | |
#- name: Commit full changelog to repo | |
# run: | | |
# git config user.name github-actions | |
# git config user.email github-actions@github.com | |
# git add "CHANGELOG.md" | |
# git commit -m "auto: updated changelog" | |
# git push | |
- name: Build package | |
run: | | |
python -m build | |
- name: Store package | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # 4.3.1 | |
with: | |
name: python-dist | |
path: dist | |
# ################ Release to GitHub | |
release: | |
name: Release to GitHub | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Access package | |
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # 4.1.4 | |
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@9d7c94cfd0a1f3ed45544c887983e9fa900f0564 # 2.0.4 | |
with: | |
name: ${{ needs.build.outputs.version }} | |
body: ${{ needs.build.outputs.changelog }} | |
draft: false | |
token: ${{ github.token }} | |
fail_on_unmatched_files: true | |
files: | | |
gh/*.whl | |
# other file | |
# ################ Deploy to PyPI | |
pypi: | |
name: Deploy to PyPI | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Access package | |
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # 4.1.4 | |
with: | |
name: python-dist | |
path: dist | |
- name: Deploy package | |
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # 1.8.14 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |