Skip to content

minor: updated CHANGELOG.md to 2.7.3 #38

minor: updated CHANGELOG.md to 2.7.3

minor: updated CHANGELOG.md to 2.7.3 #38

# ┌───────────────────────────────────────────────────────────────┐
# │ Contents of from_tag_to_build_release_pypi.yml │
# ├───────────────────────────────────────────────────────────────┘
# │
# ├──┐From tag
# │ └──┐Build and test
# │ ├── Release to GitHub
# │ ├── Deploy to PyPI
# │ └── Deploy to AUR
# │
# └───────────────────────────────────────────────────────────────
# ################################################################ From tag
name: Create GitHub release and deploy to PyPI from a new tag
# requirements:
# - GitHub has an environment called "release"
# - PyPI has a trusted publisher set (no need for secret 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 [email protected]
# 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
environment: release
permissions:
id-token: write
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
# ################ Deploy to AUR
aur:
runs-on: ubuntu-latest
steps:
- name: Deploy to AUR
uses: aksh1618/update-aur-package@93d86c3ea6e57fb485881f5ce8b15375dcd23918 # c1.0.5
with:
tag_version_prefix: v
package_name: toc
commit_username: "Github Action"
commit_email: [email protected]
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}