Skip to content
Open
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
20 changes: 20 additions & 0 deletions .cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,27 @@
"pull_request_strategy": "update-or-create",
"post_actions": [],
"draft": false,
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
"baked_commit_ref": "f89190c77817921c07423320bec1f944ed584503",
=======
"baked_commit_ref": "aa4dc9d386b4803f0fc02e7889aef37acf55849c",
>>>>>>> 85666b3 (Cookie updated targeting develop by NetworkToCode Cookie Drift Manager Tool)
=======
"baked_commit_ref": "a5cb520a1b5dd235ec93fb92b8d91bd029d1d6bf",
>>>>>>> 9bea393 (Cookie updated targeting develop by NetworkToCode Cookie Drift Manager Tool)
=======
"baked_commit_ref": "dc1153911581cc7c2dc9f3e5f8f74ac6cc1023dc",
>>>>>>> e9e8933 (Cookie updated targeting develop by NetworkToCode Cookie Drift Manager Tool)
=======
"baked_commit_ref": "4e88681e015d0508406660059a8e058aa5c7eaef",
>>>>>>> d140d80 (Cookie updated targeting develop by NetworkToCode Cookie Drift Manager Tool)
=======
"baked_commit_ref": "89bcaf447dfa73f5416b0ba304ea562b7ff00673",
>>>>>>> 34a9265 (Cookie updated targeting develop by NetworkToCode Cookie Drift Manager Tool)
"drift_managed_branch": "develop"
}
}
Expand Down
261 changes: 243 additions & 18 deletions .github/workflows/ci.yml

Large diffs are not rendered by default.

36 changes: 30 additions & 6 deletions .github/workflows/prepare_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ on: # yamllint disable-line rule:truthy rule:comments
description: "Date of the release YYYY-MM-DD (defaults to today's date in the US Eastern TZ)."
required: false
default: ""
previous_version:
description: "The previous version tag to use for generating release notes (defaults to the latest tag or initial commit if no tags exist)."
required: false
default: ""

jobs:
prepare-release:
Expand All @@ -31,14 +35,14 @@ jobs:
runs-on: "ubuntu-latest"
steps:
- name: "Checkout code"
uses: "actions/checkout@v4"
uses: "actions/checkout@v7"
with:
# If target_branch is 'main', use 'develop' as the source branch. Otherwise, the source and target branch are the same.
ref: "${{ github.event.inputs['target_branch'] == 'main' && 'develop' || github.event.inputs['target_branch'] }}"
fetch-depth: 0 # Fetch all history for git tags

- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
uses: "networktocode/gh-action-setup-poetry-environment@v7"
with:
poetry-version: "2.1.3"
poetry-install-options: "--with dev"
Expand All @@ -53,7 +57,11 @@ jobs:

# 2. Try to get the previous version tag
# If it fails (no tags), get the hash of the first commit
if PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null); then
if [ -n "${{ github.event.inputs.previous_version }}" ]; then
PREV_TAG="${{ github.event.inputs.previous_version }}"
echo "Using user-specified previous version: $PREV_TAG"
echo "PREVIOUS_TAG=$PREV_TAG" >> $GITHUB_ENV
elif PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null); then
echo "PREVIOUS_TAG=$PREV_TAG" >> $GITHUB_ENV
echo "Found previous tag: $PREV_TAG"
else
Expand All @@ -65,9 +73,25 @@ jobs:

- name: "Determine New Version"
id: "versioning"
env:
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: |
# Perform the bump based on the user input
poetry version ${{ github.event.inputs.bump_rule }}
# Bump the poetry version based on the user input
CURRENT_POETRY_VER=$(poetry version --short)
set +e # continue running if the next command fails
GITHUB_RELEASE_EXISTS=$(gh release view v$CURRENT_POETRY_VER --json publishedAt --jq '.publishedAt')
set -e
# Unconditionally bump the version if the current version is alpha0 or beta0
if [[ $CURRENT_POETRY_VER == *a0 || $CURRENT_POETRY_VER == *b0 || $CURRENT_POETRY_VER == *rc0 ]]; then
poetry version ${{ github.event.inputs.bump_rule }}
# If the bump rule is prerelease and a release doesn't already exist in github we don't bump the version

# This is because we've already bumped to the prerelease version after the previous release
elif [[ "${{ github.event.inputs.bump_rule }}" == "prerelease" && "$CURRENT_POETRY_VER" =~ (a|b|rc)[0-9]+$ && -z "$GITHUB_RELEASE_EXISTS" ]]; then
echo "Prerelease v$CURRENT_POETRY_VER does not exist in github, using this version"
else
poetry version ${{ github.event.inputs.bump_rule }}
fi

# Capture the New version string for use in other steps
NEW_VER=$(poetry version --short)
Expand Down Expand Up @@ -138,7 +162,7 @@ jobs:
# 7. Save to a temporary file to avoid shell argument length limits
echo "$FINAL_NOTES" > ../consolidated_notes.md

- name: "Generate Release Notes"
- name: "Generate App Release Notes and update mkdocs.yml"
run: "poetry run inv generate-release-notes --version '${{ env.NEW_VERSION }}' --date '${{ env.RELEASE_DATE }}'"

- name: "Commit Changes and Push"
Expand Down
123 changes: 109 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,50 @@ on: # yamllint disable-line rule:truthy rule:comments
release:
types: ["published"]

env:
POETRY_VERSION: "2.1.3"
PYTHON_VERSION: "3.12"
<<<<<<< HEAD
=======
INVOKE_CIRCUIT_MAINTENANCE_PARSER_LOCAL: "True"
>>>>>>> 34a9265 (Cookie updated targeting develop by NetworkToCode Cookie Drift Manager Tool)

jobs:
build:
name: "Build package with poetry"
runs-on: "ubuntu-latest"
if: "startsWith(github.ref, 'refs/tags/v')"
steps:
- uses: "actions/checkout@v4"
- uses: "actions/checkout@v7"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v7"
with:
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
poetry-version: "2.1.3"
python-version: "3.13"
=======
poetry-version: "${{ env.POETRY_VERSION }}"
python-version: "${{ env.PYTHON_VERSION }}"
>>>>>>> 9bea393 (Cookie updated targeting develop by NetworkToCode Cookie Drift Manager Tool)
=======
poetry-version: "${{ env.POETRY_VERSION }}"
python-version: "${{ env.PYTHON_VERSION }}"
>>>>>>> e9e8933 (Cookie updated targeting develop by NetworkToCode Cookie Drift Manager Tool)
=======
poetry-version: "${{ env.POETRY_VERSION }}"
python-version: "${{ env.PYTHON_VERSION }}"
>>>>>>> d140d80 (Cookie updated targeting develop by NetworkToCode Cookie Drift Manager Tool)
poetry-install-options: "--no-root"
- name: "Build Documentation"
run: "poetry run invoke build-and-check-docs"
=======
poetry-version: "${{ env.POETRY_VERSION }}"
python-version: "${{ env.PYTHON_VERSION }}"
poetry-install-options: "--with dev,docs"
>>>>>>> 34a9265 (Cookie updated targeting develop by NetworkToCode Cookie Drift Manager Tool)
- name: "Run Poetry Build"
run: "poetry build"

Expand All @@ -38,7 +69,7 @@ jobs:
contents: "write"
needs: "build"
steps:
- uses: "actions/checkout@v4"
- uses: "actions/checkout@v7"
- name: "Retrieve built package from cache"
uses: "actions/download-artifact@v4"
with:
Expand All @@ -56,19 +87,57 @@ jobs:
if: "startsWith(github.ref, 'refs/tags/v')"
needs: "build"
environment: "pypi"
# Steps to publish to PyPI.
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
# IMPORTANT: this permission is mandatory for trusted publishing.
permissions:
=======
permissions:
# IMPORTANT: this permission is mandatory for Trusted Publishing
>>>>>>> 9bea393 (Cookie updated targeting develop by NetworkToCode Cookie Drift Manager Tool)
=======
permissions:
# IMPORTANT: this permission is mandatory for Trusted Publishing
>>>>>>> e9e8933 (Cookie updated targeting develop by NetworkToCode Cookie Drift Manager Tool)
=======
permissions:
# IMPORTANT: this permission is mandatory for Trusted Publishing
>>>>>>> d140d80 (Cookie updated targeting develop by NetworkToCode Cookie Drift Manager Tool)
=======
permissions:
# IMPORTANT: this permission is mandatory for Trusted Publishing
>>>>>>> 34a9265 (Cookie updated targeting develop by NetworkToCode Cookie Drift Manager Tool)
id-token: "write"
steps:
- name: "Retrieve built package from cache"
uses: "actions/download-artifact@v4"
with:
name: "distfiles"
path: "dist/"

- name: "Publish package distributions to PyPI"
uses: "pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e" # v1.13.0
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
## Used for networktocode org since trusted publisher isn't supported for GitHub Plan.
with:
user: "__token__"
password: "${{ secrets.PYPI_API_TOKEN }}"
=======
>>>>>>> 85666b3 (Cookie updated targeting develop by NetworkToCode Cookie Drift Manager Tool)
=======
>>>>>>> 9bea393 (Cookie updated targeting develop by NetworkToCode Cookie Drift Manager Tool)
=======
>>>>>>> e9e8933 (Cookie updated targeting develop by NetworkToCode Cookie Drift Manager Tool)
=======
>>>>>>> d140d80 (Cookie updated targeting develop by NetworkToCode Cookie Drift Manager Tool)
=======
>>>>>>> 34a9265 (Cookie updated targeting develop by NetworkToCode Cookie Drift Manager Tool)

slack-notify:
needs:
Expand Down Expand Up @@ -109,35 +178,46 @@ jobs:
permissions:
contents: "write"
pull-requests: "write"
name: "Create a PR from main into develop"
name: "${{ github.event.release.target_commitish == 'main' && 'Create a PR from main into develop' || format('Create a PR to merge into {0}', github.event.release.target_commitish) }}"
needs:
- "publish-github"
- "publish-pypi"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout main"
- name: "Checkout source branch"
<<<<<<< HEAD
uses: "actions/checkout@v4"
=======
uses: "actions/checkout@v7"
>>>>>>> 34a9265 (Cookie updated targeting develop by NetworkToCode Cookie Drift Manager Tool)
with:
ref: "main"
ref: "${{ github.event.release.target_commitish }}"
fetch-depth: 0

- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
uses: "networktocode/gh-action-setup-poetry-environment@v7"
with:
poetry-version: "2.1.3"
poetry-version: "${{ env.POETRY_VERSION }}"
poetry-install-options: "--no-root"

- name: "Create release branch from main"
- name: "Create release branch and bump version"
id: "branch"
run: |

git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"

SOURCE_BRANCH="${{ github.event.release.target_commitish }}"
if [ "$SOURCE_BRANCH" = "main" ]; then
TARGET_BRANCH="develop"
else
TARGET_BRANCH="$SOURCE_BRANCH"
fi

TAG_NAME="${{ github.event.release.tag_name }}"
VERSION="${TAG_NAME#v}"

BRANCH_NAME="release-${VERSION}-to-develop"
BRANCH_NAME="release-${VERSION}-to-${TARGET_BRANCH}"

# Ensure release branch doesn't already exist
if git rev-parse --verify origin/$BRANCH_NAME > /dev/null 2>&1; then
Expand All @@ -147,18 +227,33 @@ jobs:

git checkout -b "$BRANCH_NAME"

poetry version prepatch
poetry version prerelease
git add pyproject.toml && git commit -m "Bump version"
git push origin "$BRANCH_NAME"

echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
echo "target_branch=$TARGET_BRANCH" >> $GITHUB_OUTPUT

- name: "Create Pull Request"
env:
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: |
gh pr create \
--title "Post release ${{ github.event.release.tag_name }} to ${{ steps.branch.outputs.target_branch }}" \
<<<<<<< HEAD
--body "Please do a merge commit." \
--base "${{ steps.branch.outputs.target_branch }}" \
--head "${{ steps.branch.outputs.branch_name }}"

- name: "Create Pull Request to develop"
- name: "Create Pull Request"
if: "steps.branch.outputs.branch_name != ''"
env:
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: |
gh pr create \
--title "Post release ${{ github.event.release.tag_name }} to develop" \
--title "Sync release notes from ${{ github.event.release.target_commitish }} (${{ github.event.release.tag_name }}) to develop" \
=======
>>>>>>> 34a9265 (Cookie updated targeting develop by NetworkToCode Cookie Drift Manager Tool)
--body "Please do a merge commit." \
--base "develop" \
--base "${{ steps.branch.outputs.target_branch }}" \
--head "${{ steps.branch.outputs.branch_name }}"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ fabric.properties
# Rando
creds.env
development/*.txt
!development/towncrier_header.txt

# Invoke overrides
invoke.yml
Expand All @@ -309,3 +310,4 @@ docs/CHANGELOG.md
public
/compose.yaml
/dump.sql
/circuit-maintenance-parser/static/*
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
# circuit-maintenance-parser

<p align="center">
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
=======
=======
>>>>>>> 9bea393 (Cookie updated targeting develop by NetworkToCode Cookie Drift Manager Tool)
=======
>>>>>>> e9e8933 (Cookie updated targeting develop by NetworkToCode Cookie Drift Manager Tool)
=======
>>>>>>> d140d80 (Cookie updated targeting develop by NetworkToCode Cookie Drift Manager Tool)
=======
>>>>>>> 34a9265 (Cookie updated targeting develop by NetworkToCode Cookie Drift Manager Tool)
<img src="https://raw.githubusercontent.com/networktocode/circuit-maintenance-parser/develop/docs/images/icon-circuit-maintenance-parser.png" class="logo" height="200px">
<br>
>>>>>>> 85666b3 (Cookie updated targeting develop by NetworkToCode Cookie Drift Manager Tool)
<a href="https://github.com/networktocode/circuit-maintenance-parser/actions"><img src="https://github.com/networktocode/circuit-maintenance-parser/actions/workflows/ci.yml/badge.svg?branch=main"></a>
<a href="https://circuit-maintenance-parser.readthedocs.io/en/latest/"><img src="https://readthedocs.org/projects/circuit-maintenance-parser/badge/"></a>
<a href="https://pypi.org/project/circuit-maintenance-parser/"><img src="https://img.shields.io/pypi/v/circuit-maintenance-parser"></a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
It shouldn't be necessary to run this file manually. It is automatically called by `invoke generate-release-notes`.

Example:
$ python bin/ensure_release_notes.py --version '1.0'
$ python ensure_release_notes.py --version '1.0.0'
"""

import argparse
Expand All @@ -23,7 +23,7 @@

def release_notes_pyproject_toml(version):
"""Update the pyproject.toml file to set the towncrier filename for the given version."""
pyproject_file = Path(__file__).parent.parent / "pyproject.toml"
pyproject_file = Path(__file__).parent.parent.parent / "pyproject.toml"
pyproject_content = pyproject_file.read_text()
pyproject_data = tomllib.loads(pyproject_content)
release_notes_file = f"docs/admin/release_notes/version_{version}.md"
Expand Down Expand Up @@ -62,7 +62,9 @@ def release_notes_pyproject_toml(version):

def ensure_release_notes_file(version):
"""Ensure that the release notes file for the given version exists and is referenced in mkdocs.yml."""
release_notes_file = Path(__file__).parent.parent / "docs" / "admin" / "release_notes" / f"version_{version}.md"
release_notes_file = (
Path(__file__).parent.parent.parent / "docs" / "admin" / "release_notes" / f"version_{version}.md"
)
if not release_notes_file.exists():
# Create a new release notes file with a basic template from towncrier_header.txt
towncrier_header = Path(__file__).parent.parent / "towncrier_header.txt"
Expand All @@ -72,7 +74,7 @@ def ensure_release_notes_file(version):

def ensure_mkdocs_version(version):
"""Ensure that mkdocs.yml includes the new release notes file in the navigation."""
mkdocs_yml_file = Path(__file__).parent.parent / "mkdocs.yml"
mkdocs_yml_file = Path(__file__).parent.parent.parent / "mkdocs.yml"
mkdocs_yml_content = mkdocs_yml_file.read_text()
release_notes_nav_entry = f' - v{version}: "admin/release_notes/version_{version}.md"\n'
if release_notes_nav_entry in mkdocs_yml_content:
Expand Down
File renamed without changes.
Loading