Skip to content

Merge main into staging #627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 15, 2025
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
8 changes: 4 additions & 4 deletions release-scripts/generate-release-notes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
"\n",
"### Create release folder and file\n",
"\n",
"These lines will create a folder inside of `~/site/releases` for the new release notes to live in and sets stage for the release notes to be generated. The folder name is the release date, as per our convention. \n",
"These lines will create a folder inside of `~/site/releases` for the new release notes to live in and sets stage for the release notes to be generated. The folder name is the release date tucked into the yearly folder, as per our convention. \n",
"\n",
"**If the directory and release file already exists, you will be prompted to confirm whether or not you want to overwrite the contents.**"
]
Expand All @@ -233,7 +233,7 @@
"metadata": {},
"outputs": [],
"source": [
"output_file = gro.create_release_folder(gro.formatted_release_date)"
"output_file, year = gro.create_release_folder(gro.formatted_release_date)"
]
},
{
Expand Down Expand Up @@ -567,7 +567,7 @@
"metadata": {},
"outputs": [],
"source": [
"gro.update_quarto_yaml(gro.release_datetime)"
"gro.update_quarto_yaml(gro.release_datetime, year)"
]
},
{
Expand All @@ -586,7 +586,7 @@
"metadata": {},
"outputs": [],
"source": [
"gro.update_index_qmd(gro.release_datetime)"
"gro.update_index_qmd(gro.release_datetime, year)"
]
},
{
Expand Down
22 changes: 13 additions & 9 deletions release-scripts/generate_release_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,11 @@ def create_release_folder(formatted_release_date):
Returns:
str: The path to the release notes file, or exits the script if the user chooses not to overwrite.
"""
directory_path = f"../site/releases/{formatted_release_date}/"
# Parse the input date
parsed_date = datetime.datetime.strptime(formatted_release_date, "%Y-%b-%d")
year = parsed_date.year
formatted_date = parsed_date.strftime("%Y-%b-%d").lower() # e.g., "2025-jan-17"
directory_path = f"../site/releases/{year}/{formatted_date}/"
output_file = f"{directory_path}release-notes.qmd"

# Check if the directory and file already exist
Expand All @@ -454,7 +458,7 @@ def create_release_folder(formatted_release_date):
os.makedirs(directory_path, exist_ok=True)
print(f"{output_file} will be created or overwritten")

return output_file
return output_file, year

def create_release_qmd(output_file, original_release_date):
"""
Expand Down Expand Up @@ -727,7 +731,7 @@ def upgrade_info(output_file):
except Exception as e:
print(f"Failed to include _how-to-upgrade.qmd to {output_file}: {e}")

def update_quarto_yaml(release_date):
def update_quarto_yaml(release_date, year):
"""Updates the _quarto.yml file to include the release notes file so it can be accessed on the website.

Params:
Expand All @@ -740,7 +744,7 @@ def update_quarto_yaml(release_date):

# Format the release date for insertion into the YAML file
formatted_release_date = release_date.strftime("%Y-%b-%d").lower()
target_line = f' - releases/{formatted_release_date}/release-notes.qmd\n'
target_line = f' - releases/{year}/{formatted_release_date}/release-notes.qmd\n'

# Check if the target line already exists in the YAML file
with open(yaml_filename, 'r') as file:
Expand Down Expand Up @@ -775,7 +779,7 @@ def update_quarto_yaml(release_date):

print(f"Added new release notes to _quarto.yml, line {insert_index + 2}")

def update_index_qmd(release_date):
def update_index_qmd(release_date, year):
"""Updates the index.qmd file to include the new releases in `Latest Releases` and removes the oldest release from the list.

Params:
Expand All @@ -789,7 +793,7 @@ def update_index_qmd(release_date):

# Format the release date for checking and insertion into the QMD file
formatted_release_date = release_date.strftime("%Y-%b-%d").lower()
new_release_entry = f' - /releases/{formatted_release_date}/release-notes.qmd\n'
new_release_entry = f' - /releases/{year}/{formatted_release_date}/release-notes.qmd\n'

# Check if the release note already exists
with open(index_filename, 'r') as file:
Expand Down Expand Up @@ -911,7 +915,7 @@ def main():
print()

# Handle potential failure in create_release_folder
output_file = create_release_folder(formatted_release_date)
output_file, year = create_release_folder(formatted_release_date)
if not output_file: # Ensure the function returns something valid
raise RuntimeError("Failed to create release folder.")
print()
Expand Down Expand Up @@ -965,10 +969,10 @@ def main():
upgrade_info(output_file)
print()

update_quarto_yaml(release_datetime)
update_quarto_yaml(release_datetime, year)
print()

update_index_qmd(release_datetime)
update_index_qmd(release_datetime, year)
print()

except Exception as e:
Expand Down
124 changes: 28 additions & 96 deletions release-scripts/year-end-cleanup.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Year end release cleanup"
"# Year-end release cleanup"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This notebook automatically moves a full year of releases into their own subdirectory under `~site/releases/` and collates the releases into their yearly listing page, including a preliminary tidy up of any links broken by moving these files. \n",
"This notebook automatically collates a full year of releases into a yearly listing page under `~site/releases/` , including a preliminary tidy up of any links broken by moving these files. \n",
"\n",
"It's easiest to run this notebook at the start of the new year, when all the releases for the previous year are ready to be collated, thus requiring minimum adjustment from you.\n",
"It's easiest to run this notebook at the start of the new year, when all the releases for the previous year are ready to be collected, thus requiring minimum adjustment from you.\n",
"\n",
"After running the notebook, you can locate the new yearly release subdirectory that was inserted into our `About > Releases` section for you to clean up further, along with a live preview of the site to get you started."
"After running the notebook, you can review the new yearly release listing page that was inserted into our `About > Releases` section for you to clean up further, along with a live preview of the site to get you started."
]
},
{
Expand All @@ -28,18 +28,15 @@
" - [Import yearly cleanup script](#toc2_1_) \n",
" - [Specify the year](#toc2_2_) \n",
" - [Retrieve matching release folders](#toc2_3_) \n",
"- [Creating the yearly folder](#toc3_) \n",
" - [Create the yearly folder](#toc3_1_) \n",
" - [Move releases into yearly folder](#toc3_2_) \n",
" - [Create yearly listing page](#toc3_3_) \n",
" - [Edit the yearly listing page](#toc3_4_) \n",
" - [Retrieve moved releases](#toc3_5_) \n",
" - [Add moved releases to listing page](#toc3_6_) \n",
"- [Rounding up the yearly releases](#toc3_) \n",
" - [Retrieve the yearly folder](#toc3_1_) \n",
" - [Create yearly listing page](#toc3_2_) \n",
" - [Edit the yearly listing page](#toc3_3_) \n",
" - [Retrieve yearly release pages](#toc3_4_) \n",
" - [Add releases to yearly listing page](#toc3_5_) \n",
"- [Updating sidebar and links](#toc4_) \n",
" - [Add yearly release folder to sidebar](#toc4_1_) \n",
" - [Move year end marker](#toc4_2_) \n",
" - [Fix broken filepaths](#toc4_3_) \n",
" - [Retrieve relative paths](#toc4_4_) \n",
" - [Move year end marker](#toc4_2_) \n",
"- [Next steps](#toc5_) \n",
" - [Show files to commit](#toc5_1_) \n",
" - [Preview changes](#toc5_2_) \n",
Expand Down Expand Up @@ -95,7 +92,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -143,7 +140,7 @@
"metadata": {},
"outputs": [],
"source": [
"yc.get_yearly_releases(year)"
"yc.get_yearly_releases(year);"
]
},
{
Expand All @@ -152,7 +149,7 @@
"source": [
"<a id='toc3_'></a>\n",
"\n",
"## Creating the yearly folder "
"## Rounding up the yearly releases"
]
},
{
Expand All @@ -161,9 +158,9 @@
"source": [
"<a id='toc3_1_'></a>\n",
"\n",
"### Create the yearly folder \n",
"### Retrieve the yearly folder \n",
"\n",
"The following cell creates a new subdirectory in `~site/releases/` based on your specified year."
"The following cell locates the yearly subdirectory in `~site/releases/` based on your specified year so we can use the filepath in later functions."
]
},
{
Expand All @@ -172,7 +169,7 @@
"metadata": {},
"outputs": [],
"source": [
"yearly_path = yc.create_year_folder(year)"
"yearly_path = yc.retrieve_year_folder(year)"
]
},
{
Expand All @@ -181,29 +178,9 @@
"source": [
"<a id='toc3_2_'></a>\n",
"\n",
"### Move releases into yearly folder \n",
"\n",
"Once we have the folder available, your matching release folders will get moved into this new yearly subdirectory."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"yc.move_yearly_releases(yearly_path, yc.release_folders)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<a id='toc3_3_'></a>\n",
"\n",
"### Create yearly listing page \n",
"\n",
"This cell copies the template from `~internal/templates/yearly-releases.qmd` and slots it into the new yearly folder as `{year}-releases.qmd` so we can begin building the yearly listings.\n",
"This cell copies the template from `~internal/templates/yearly-releases.qmd` and slots it into the the yearly folder as `{year}-releases.qmd` so we can begin building the yearly listings.\n",
"\n",
"**It will also open up the newly created `{year}-releases.qmd` file for you so you don't have to go looking for it.**"
]
Expand All @@ -221,7 +198,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"<a id='toc3_4_'></a>\n",
"<a id='toc3_3_'></a>\n",
"\n",
"### Edit the yearly listing page \n",
"\n",
Expand All @@ -248,11 +225,11 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"<a id='toc3_5_'></a>\n",
"<a id='toc3_4_'></a>\n",
"\n",
"### Retrieve moved releases \n",
"### Retrieve yearly release pages\n",
"\n",
"This cell returns the `release-notes.qmd` filepaths for all the release folders we just moved into the yearly subdirectory."
"This cell returns the `release-notes.qmd` filepaths for all the release folders in our matching yearly subdirectory."
]
},
{
Expand All @@ -268,11 +245,11 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"<a id='toc3_6_'></a>\n",
"<a id='toc3_5_'></a>\n",
"\n",
"### Add moved releases to listing page \n",
"### Add releases to yearly listing page \n",
"\n",
"Next, we'll insert the moved release files into the listing for the yearly roundup page sorted by the release dates in descending order (newest first)."
"Next, we'll insert that year's release pages into the listing for the yearly roundup page sorted by the release dates in descending order (newest first)."
]
},
{
Expand Down Expand Up @@ -302,9 +279,9 @@
"\n",
"### Add yearly release folder to sidebar \n",
"\n",
"Since we moved our releases for the specified year into their own subfolder, we'll need to update the sidebar in `_quarto.yml` to accomodate.\n",
"Now that we've created the yearly listing page, we need to update the sidebar in `_quarto.yml` to accomodate.\n",
"\n",
"**This cell takes all the release filepaths we just moved into our yearly folder and shoves them into a `contents:` accordion menu with the new `{year}-.releases.qmd` listing page as the landing page.** \n"
"**This cell takes all the release filepaths matching our year and shoves them into a `contents:` accordion menu with the new `{year}-.releases.qmd` listing page as the landing page.** \n"
]
},
{
Expand Down Expand Up @@ -336,48 +313,6 @@
"yc.move_year_marker(year)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<a id='toc4_3_'></a>\n",
"\n",
"### Fix broken filepaths \n",
"\n",
"This cell looks for absolute filepaths in `.qmd` and `.yml` files in `~site/` matching `releases/{year}-` and renames them `releases/{year}/{year}-` to accomodate for the releases we moved."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"yc.update_paths(year)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<a id='toc4_4_'></a>\n",
"\n",
"### Retrieve relative paths \n",
"\n",
"This cell looks for relative paths (`../example.qmd`) in the `~site/releases/` folder that might need manual adjustment, such as in listings or any links that don't follow our proper `/root` convention but should. \n",
"\n",
"**You will ned to review these links and edit them if necessary to ensure that the filepaths are not broken after the move.**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"yc.search_links(yearly_path)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -451,10 +386,7 @@
"**You may want to send a commit up to remote before you begin editing so you have a backup.**\n",
"\n",
"- [ ] Make sure that the new yearly accordion menu displays as expected in the sidebar under `About > Releases`.\n",
"- [ ] Check in `_quarto.yml` that the `# CURRENT-YEAR-END-MARKER` was moved to above your rounded up releases for your specified year.\n",
"- [ ] Double-check the files edited by `Fix broken filepaths` to ensure that the new links resolve correctly\n",
"- [ ] Resolve any relative links found in `Retrieve relative paths` that were broken by the move. \n",
"- [ ] Resolve any other links that might have been broken by the move by checking using `quarto render`. \n",
"- [ ] Check in `_quarto.yml` that the `# CURRENT-YEAR-END-MARKER` was moved to above your rounded up releases for your specified year. \n",
"- [ ] Review the summaries at the top of each release page to make sure they look good on the listing tiles.\n",
"- [ ] Make sure any relevant files are committed to remote in preparation for your PR!"
]
Expand Down
Loading