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
78 changes: 78 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Publish Release

on:
push:
branches: [master]

concurrency:
group: publish-release-${{ github.ref }}
cancel-in-progress: false

jobs:
check:
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
version: ${{ steps.release.outputs.version }}
should_release: ${{ steps.release.outputs.should_release }}

steps:
- uses: actions/checkout@v7

- name: Set up Python 3.14
uses: actions/setup-python@v6
with:
python-version: "3.14"

- name: Check for existing release or tag
id: release
env:
GH_TOKEN: ${{ github.token }}
run: |
version=$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["tool"]["poetry"]["version"])')
tag="v${version}"

if gh release view "$tag" >/dev/null 2>&1 || gh api "repos/${GITHUB_REPOSITORY}/git/ref/tags/${tag}" >/dev/null 2>&1; then
should_release=false
else
should_release=true
fi

echo "version=${version}" >> "$GITHUB_OUTPUT"
echo "should_release=${should_release}" >> "$GITHUB_OUTPUT"

publish:
needs: check
if: needs.check.outputs.should_release == 'true'
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/to-ascii

permissions:
contents: write
id-token: write

steps:
- uses: actions/checkout@v7

- name: Set up Python 3.14
uses: actions/setup-python@v6
with:
python-version: "3.14"

- name: Install Poetry
run: python -m pip install poetry

- name: Build package
run: poetry build

- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1

- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ needs.check.outputs.version }}
run: gh release create "v${VERSION}" --target "$GITHUB_SHA" --title "v${VERSION}" --generate-notes
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "to-ascii"
version = "6.1.1"
version = "6.2.0"
description = "Convert videos, images, gifs, and even live video to ASCII art!"
authors = ["Milo Weinberg <iapetus011@gmail.com>"]
license = "MIT"
Expand Down
Loading