Skip to content

Commit

Permalink
More workflow cleanup (#380)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 authored Sep 13, 2022
1 parent e8dd7b6 commit 7e4ad4b
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .github/actions/draft-release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ inputs:
target:
description: "The owner/repo GitHub target"
required: false
branch:
description: "The target branch"
required: false
release_url:
description: "The full url to the GitHub release page"
required: false
Expand Down Expand Up @@ -43,4 +46,5 @@ runs:
export RH_DRY_RUN=${{ inputs.dry_run }}
export RH_STEPS_TO_SKIP=${{ inputs.steps_to_skip }}
export RH_RELEASE_URL=${{ inputs.release_url }}
export RH_BRANCH=${{ inputs.branch }}
python -m jupyter_releaser.actions.draft_release
4 changes: 4 additions & 0 deletions .github/actions/publish-release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ inputs:
target:
description: "The owner/repo GitHub target"
required: false
branch:
description: "The target branch"
required: false
release_url:
description: "The full url to the GitHub release page"
required: false
Expand Down Expand Up @@ -45,4 +48,5 @@ runs:
export RH_DRY_RUN=${{ inputs.dry_run }}
export RH_RELEASE_URL=${{ inputs.release_url }}
export RH_STEPS_TO_SKIP=${{ inputs.steps_to_skip }}
export RH_BRANCH=${{ inputs.branch }}
python -m jupyter_releaser.actions.publish_release
1 change: 1 addition & 0 deletions .github/workflows/draft-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ on:
since_last_stable:
description: "Use PRs with activity since the last stable git tag"
required: false
type: boolean
jobs:
draft_changelog:
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/draft-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
target:
description: "The owner/repo GitHub target"
required: false
branch:
description: "The target branch"
required: false
release_url:
description: "The URL of the draft GitHub release"
required: false
Expand Down Expand Up @@ -34,6 +37,7 @@ jobs:
target: ${{ github.event.inputs.target }}
release_url: ${{ github.event.inputs.release_url }}
steps_to_skip: ${{ github.event.inputs.steps_to_skip }}
branch: ${{ github.event.inputs.branch }}

- name: "** Next Step **"
run: |
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/full-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
target:
description: "The owner/repo GitHub target"
required: false
branch:
description: "The target branch"
required: false
release_url:
description: "The URL of the draft GitHub release"
required: false
Expand Down Expand Up @@ -32,6 +35,7 @@ jobs:
with:
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
target: ${{ github.event.inputs.target }}
branch: ${{ github.event.inputs.branch }}
release_url: ${{ github.event.inputs.release_url }}
steps_to_skip: ${{ github.event.inputs.steps_to_skip }}

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
target:
description: "The owner/repo GitHub target"
required: false
branch:
description: "The target branch"
required: false
release_url:
description: "The URL of the draft GitHub release"
required: false
Expand Down Expand Up @@ -34,6 +37,7 @@ jobs:
target: ${{ github.event.inputs.target }}
release_url: ${{ github.event.inputs.release_url }}
steps_to_skip: ${{ github.event.inputs.steps_to_skip }}
branch: ${{ github.event.inputs.branch }}

- name: "** Next Step **"
run: |
Expand Down
11 changes: 10 additions & 1 deletion jupyter_releaser/actions/draft_changelog.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import os

from jupyter_releaser.actions.common import make_group, run_action, setup
from jupyter_releaser.util import handle_since
from jupyter_releaser.util import CHECKOUT_NAME, get_default_branch, handle_since

setup()

run_action("jupyter-releaser prep-git")

# Handle the branch.
if not os.environ.get("RH_BRANCH"):
cur_dir = os.getcwd()
os.chdir(CHECKOUT_NAME)
os.environ["RH_BRANCH"] = get_default_branch() or ""
os.chdir(cur_dir)

# Capture the "since" variable in case we add tags before checking changelog
# Do this before bumping the version.
with make_group("Handle RH_SINCE"):
Expand Down
4 changes: 4 additions & 0 deletions jupyter_releaser/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
START_MARKER = "<!-- <START NEW CHANGELOG ENTRY> -->"
END_MARKER = "<!-- <END NEW CHANGELOG ENTRY> -->"
PR_PREFIX = "Automated Changelog Entry"
PRECOMMIT_PREFIX = "[pre-commit.ci] pre-commit autoupdate"


def format_pr_entry(target, number, auth=None, dry_run=False):
Expand Down Expand Up @@ -133,6 +134,9 @@ def get_version_entry(
# Remove automated changelog PRs
entry = [e for e in entry if PR_PREFIX not in e]

# Remove Pre-Commit PRs
entry = [e for e in entry if PRECOMMIT_PREFIX not in e]

entry = "\n".join(entry).strip()

# Remove empty documentation entry if only automated changelogs were there
Expand Down
8 changes: 6 additions & 2 deletions jupyter_releaser/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,15 +553,19 @@ def prepare_environment():
def handle_since():
"""Capture the "since" argument in case we add tags before checking changelog."""
if os.environ.get("RH_SINCE"):
log(f"Using RH_SINCE from env: {os.environ.get('RH_SINCE')}")
return
curr_dir = os.getcwd()
os.chdir(CHECKOUT_NAME)
since_last_stable_env = os.environ.get("RH_SINCE_LAST_STABLE")
since_last_stable = since_last_stable_env == "true"
since_last_stable_env = os.environ.get("RH_SINCE_LAST_STABLE", "")
since_last_stable = since_last_stable_env.lower() == "true"
log(f"Since last stable? {since_last_stable}")
since = get_latest_tag(os.environ.get("RH_BRANCH"), since_last_stable)
if since:
log(f"Capturing {since} in RH_SINCE variable")
os.environ["RH_SINCE"] = since
else:
log("No last stable found!")
os.chdir(curr_dir)
return since

Expand Down

0 comments on commit 7e4ad4b

Please sign in to comment.