From e6bd7a9d8da3313911d133cd1f69eca5cd6c44da Mon Sep 17 00:00:00 2001 From: Devon Stewart Date: Fri, 8 Dec 2023 17:24:04 -0800 Subject: [PATCH] Fully automatic release versioning (#197) * Tweak default release-drafter config * Bump copyright * Bump release version * Moving versioning responsibility into GitHub Actions * Modernizing RELEASING.md --- .github/release-drafter.yml | 2 +- .github/workflows/python-publish.yml | 17 +++++++++++++++++ RELEASING | 6 ------ RELEASING.md | 8 ++++++++ docs/conf.py | 4 ++-- pyproject.toml | 2 +- 6 files changed, 29 insertions(+), 10 deletions(-) delete mode 100644 RELEASING create mode 100644 RELEASING.md diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index fcca4ea8..cae5795b 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,4 +1,4 @@ -name-template: 'v$RESOLVED_VERSION 🌈' +name-template: 'v$RESOLVED_VERSION' tag-template: 'v$RESOLVED_VERSION' categories: - title: '🚀 Features' diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 7719fd2a..b7b82df5 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -14,14 +14,31 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Set up Python uses: actions/setup-python@v2 with: python-version: '3.x' + - name: Install dependencies run: | python -m pip install --upgrade pip pip install --upgrade poetry + + - name: Set release version + run: | + tag="${GITHUB_REF_NAME}" + version="${tag#v}" # Strip leading v + + # Bump poetry tag + poetry version "$version" + + # Bump docs tag + sed -i'' 's/^release = "[^"]*"/release = "'"$version"'"/' docs/conf.py + # Bump docs copyright + year="$(date +%Y)" + sed -i'' 's/^copyright = "[^"]*"/copyright = "Replit, '"$year"'"/' docs/conf.py + - name: Build and publish run: | poetry build diff --git a/RELEASING b/RELEASING deleted file mode 100644 index 3147deb7..00000000 --- a/RELEASING +++ /dev/null @@ -1,6 +0,0 @@ -Update version marker in: - - - ./pyproject.toml - - ./docs/_sphinx/conf.py - -$ poetry publish --build diff --git a/RELEASING.md b/RELEASING.md new file mode 100644 index 00000000..053940ed --- /dev/null +++ b/RELEASING.md @@ -0,0 +1,8 @@ +Cutting new releases is fully managed by GitHub Actions. +Version numbers do not need to be set in files prior to releasing, as they are incorporated on the fly. + +1. Navigate to https://github.com/replit/replit-py/releases +1. Find the latest `Draft` release, click `Edit` +1. Verify that the draft looks like what you'd expect +1. Scroll to the bottom and click `Publish` +1. Navigate to [`Upload Python Package`](https://github.com/replit/replit-py/actions/workflows/python-publish.yml) and watch your release diff --git a/docs/conf.py b/docs/conf.py index 29f63ebc..d2af8d70 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -22,11 +22,11 @@ # -- Project information ----------------------------------------------------- project = "replit-py" -copyright = "2021" +copyright = "Replit, 2023" author = "Replit" # The full version, including alpha/beta/rc tags -release = "3.3.0" +release = "0.0.0" # Set via GitHub Actions html_theme = "alabaster" # -- General configuration --------------------------------------------------- diff --git a/pyproject.toml b/pyproject.toml index e27c8611..cbec28ae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "replit" -version = "3.5.0" +version = "0.0.0" # Set by GitHub Actions description = "A library for interacting with features of repl.it" authors = ["Repl.it ", "mat ", "kennethreitz ", "Scoder12 ", "AllAwesome497", ] license = "ISC"