Skip to content

Commit

Permalink
Refactor and Simplify Workflows (#363)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
blink1073 and pre-commit-ci[bot] authored Sep 12, 2022
1 parent 519b8dd commit 2cd3e74
Show file tree
Hide file tree
Showing 27 changed files with 660 additions and 449 deletions.
9 changes: 8 additions & 1 deletion .github/actions/check-links/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ runs:
using: "composite"
steps:
- name: install-releaser
uses: jupyter-server/jupyter_releaser/.github/actions/install-releaser@v1
shell: bash -eux {0}
id: install-releaser
run: |
# Install Jupyter Releaser from git unless we are testing Releaser itself
if ! command -v jupyter-releaser &> /dev/null
then
pip install -q git+https://github.com/jupyter-server/jupyter_releaser.git@v1
fi
- name: Cache checked links
uses: actions/cache@v2
Expand Down
67 changes: 35 additions & 32 deletions .github/actions/check-release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,48 @@ inputs:
token:
description: "GitHub access token"
required: true
changelog:
description: "Changelog file"
default: "CHANGELOG.md"
required: false
version_spec:
description: "New Version Specifier"
required: false
default: ""
steps_to_skip:
description: "Comma separated list of steps to skip"
required: false
runs:
using: "composite"
steps:
- name: install-releaser
uses: jupyter-server/jupyter_releaser/.github/actions/install-releaser@v1
- shell: bash -eux {0}
id: install-releaser
run: |
# Install Jupyter Releaser from git unless we are testing Releaser itself
if ! command -v jupyter-releaser &> /dev/null
then
pip install -q git+https://github.com/jupyter-server/jupyter_releaser.git@v1
fi
- name: draft-changelog
uses: jupyter-server/jupyter_releaser/.github/actions/draft-changelog@v1
env:
RH_IS_CHECK_RELEASE: "true"
with:
dry_run: true
token: ${{ inputs.token }}
changelog: ${{ inputs.changelog }}
version_spec: ${{ inputs.version_spec }}
- id: draft-changelog
shell: bash -eux {0}
run: |
export RH_IS_CHECK_RELEASE="true"
export GITHUB_ACCESS_TOKEN=${{ inputs.token }}
export RH_VERSION_SPEC=${{ inputs.version_spec }}
export RH_STEPS_TO_SKIP=${{ inputs.steps_to_skip }}
python -m jupyter_releaser.actions.draft_changelog
- name: draft-release
uses: jupyter-server/jupyter_releaser/.github/actions/draft-release@v1
env:
RH_IS_CHECK_RELEASE: "true"
with:
dry_run: true
token: ${{ inputs.token }}
changelog: ${{ inputs.changelog }}
version_spec: ${{ inputs.version_spec }}
- id: draft-release
shell: bash -eux {0}
run: |
export RH_IS_CHECK_RELEASE="true"
export GITHUB_ACCESS_TOKEN=${{ inputs.token }}
export RH_RELEASE_URL=${{ steps.draft-changelog.outputs.release_url }}
export RH_STEPS_TO_SKIP=${{ inputs.steps_to_skip }}
python -m jupyter_releaser.actions.draft_release
- name: publish-release
uses: jupyter-server/jupyter_releaser/.github/actions/publish-release@v1
env:
RH_IS_CHECK_RELEASE: "true"
with:
dry_run: true
token: ${{ inputs.token }}
release_url: ""
- id: publish-release
shell: bash -eux {0}
run: |
export RH_IS_CHECK_RELEASE="true"
export GITHUB_ACCESS_TOKEN=${{ inputs.token }}
export RH_RELEASE_URL=${{ steps.draft-changelog.outputs.release_url }}
export RH_STEPS_TO_SKIP=${{ inputs.steps_to_skip }}
python -m jupyter_releaser.actions.publish_release
37 changes: 21 additions & 16 deletions .github/actions/draft-changelog/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,53 +6,58 @@ inputs:
required: true
version_spec:
description: "New Version Specifier"
required: true
default: "next"
required: false
post_version_spec:
description: "Post Version Specifier"
required: false
target:
description: "The owner/repo GitHub target"
required: true
branch:
description: The branch to target"
required: false
changelog:
description: "Changelog file"
default: "CHANGELOG.md"
description: "The branch to target"
required: false
dry_run:
description: "If set, do not make a PR"
default: "false"
required: false
since:
description: Use PRs with activity since this date or git reference
description: "Use PRs with activity since this date or git reference"
required: false
since_last_stable:
description: Use PRs with activity since the last stable git tag
description: "Use PRs with activity since the last stable git tag"
required: false
outputs:
pr_url:
description: "The URL of the Changelog Pull Request"
value: ${{ steps.draft-changelog.outputs.pr_url }}
release_url:
description: "The html URL of the draft GitHub release"
value: ${{ steps.draft-release.outputs.release_url }}
runs:
using: "composite"
steps:
- name: install-releaser
uses: jupyter-server/jupyter_releaser/.github/actions/install-releaser@v1

- shell: bash
id: draft-changelog
shell: bash -eux {0}
run: |
set -eux
# Install Jupyter Releaser from git unless we are testing Releaser itself
if ! command -v jupyter-releaser &> /dev/null
then
pip install -q git+https://github.com/jupyter-server/jupyter_releaser.git@v1
fi
# Set up env variables
- id: draft-changelog
shell: bash -eux {0}
run: |
export GITHUB_ACCESS_TOKEN=${{ inputs.token }}
export RH_REPOSITORY=${{ inputs.target }}
if [ ! -z ${{ inputs.branch }} ]; then
export RH_BRANCH=${{ inputs.branch }}
fi
export RH_VERSION_SPEC=${{ inputs.version_spec }}
export RH_CHANGELOG=${{ inputs.changelog }}
export RH_POST_VERSION_SPEC=${{ inputs.post_version_spec }}
export RH_DRY_RUN=${{ inputs.dry_run }}
export RH_SINCE=${{ inputs.since }}
export RH_SINCE_LAST_STABLE=${{ inputs.since_last_stable }}
# Draft Changelog
python -m jupyter_releaser.actions.draft_changelog
45 changes: 14 additions & 31 deletions .github/actions/draft-release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,16 @@ inputs:
required: true
target:
description: "The owner/repo GitHub target"
required: true
branch:
description: The branch to target
required: true
version_spec:
description: "New Version Specifier"
required: true
post_version_spec:
description: "Post Version Specifier"
required: false
release_url:
description: "The full url to the GitHub release page"
required: false
dry_run:
description: "If set, do not push permanent changes"
default: "false"
required: false
since:
description: Use PRs with activity since this date or git reference
required: false
since_last_stable:
description: Use PRs with activity since the last stable git tag
required: false
steps_to_skip:
description: Comma separated list of steps to skip
description: "Comma separated list of steps to skip"
required: false

outputs:
Expand All @@ -39,25 +27,20 @@ runs:
using: "composite"
steps:
- name: install-releaser
uses: jupyter-server/jupyter_releaser/.github/actions/install-releaser@v1

- shell: bash
id: draft-release
shell: bash -eux {0}
run: |
set -eux
# Install Jupyter Releaser from git unless we are testing Releaser itself
if ! command -v jupyter-releaser &> /dev/null
then
pip install -q git+https://github.com/jupyter-server/jupyter_releaser.git@v1
fi
# Set up env variables
- id: draft-release
shell: bash -eux {0}
run: |
export GITHUB_ACCESS_TOKEN=${{ inputs.token }}
export RH_REPOSITORY=${{ inputs.target }}
if [ ! -z ${{ inputs.branch }} ]; then
export RH_BRANCH=${{ inputs.branch }}
fi
export RH_VERSION_SPEC=${{ inputs.version_spec }}
export RH_POST_VERSION_SPEC=${{ inputs.post_version_spec }}
export RH_DRY_RUN=${{ inputs.dry_run }}
export RH_SINCE=${{ inputs.since }}
export RH_SINCE_LAST_STABLE=${{ inputs.since_last_stable }}
export RH_STEPS_TO_SKIP=${{ inputs.steps_to_skip }}
# Draft Release
export RH_RELEASE_URL=${{ inputs.release_url }}
python -m jupyter_releaser.actions.draft_release
28 changes: 16 additions & 12 deletions .github/actions/publish-release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ inputs:
token:
description: "GitHub access token"
required: true
target:
description: "The owner/repo GitHub target"
required: false
release_url:
description: "The full url to the GitHub release page"
required: true
required: false
dry_run:
description: "If set, do not push permanent changes"
default: "false"
required: false
steps_to_skip:
description: Comma separated list of steps to skip
description: "Comma separated list of steps to skip"
required: false

outputs:
Expand All @@ -27,18 +30,19 @@ runs:
using: "composite"
steps:
- name: install-releaser
uses: jupyter-server/jupyter_releaser/.github/actions/install-releaser@v1

- shell: bash
id: publish-release
shell: bash -eux {0}
run: |
# Install Jupyter Releaser from git unless we are testing Releaser itself
if ! command -v jupyter-releaser &> /dev/null
then
pip install -q git+https://github.com/jupyter-server/jupyter_releaser.git@v1
fi
- id: publish-release
shell: bash -eux {0}
run: |
set -eux
# Set up env variables
export GITHUB_ACCESS_TOKEN=${{ inputs.token }}
export RH_REPOSITORY=${{ inputs.target }}
export RH_DRY_RUN=${{ inputs.dry_run }}
export release_url=${{ inputs.release_url }}
export RH_RELEASE_URL=${{ inputs.release_url }}
export RH_STEPS_TO_SKIP=${{ inputs.steps_to_skip }}
# Publish release
python -m jupyter_releaser.actions.publish_release
16 changes: 10 additions & 6 deletions .github/workflows/draft-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@ name: "Step 1: Draft Changelog"
on:
workflow_dispatch:
inputs:
version_spec:
description: "New Version Specifier"
required: true
post_version_spec:
description: "Post Version Specifier"
required: false
target:
description: "The owner/repo GitHub target"
required: true
branch:
description: "The branch to target (defaults to default branch)"
required: false
version_spec:
description: "New Version Spec"
default: "next"
description: "The branch to target"
required: false
since:
description: "Use PRs with activity since this date or git reference"
required: false
since_last_stable:
description: "Use PRs with activity since the last stable git tag"
type: boolean
required: false
jobs:
draft_changelog:
Expand All @@ -39,6 +40,7 @@ jobs:
with:
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
version_spec: ${{ github.event.inputs.version_spec }}
post_version_spec: ${{ github.event.inputs.post_version_spec }}
target: ${{ github.event.inputs.target }}
branch: ${{ github.event.inputs.branch }}
since: ${{ github.event.inputs.since }}
Expand All @@ -47,5 +49,7 @@ jobs:
- name: "** Next Step **"
run: |
echo "Review PR: ${{ steps.draft-changelog.outputs.pr_url }}"
echo "Optional): Review Draft Release: ${{ steps.draft-changelog.outputs.release_url }}"
echo "## Next Step" >> $GITHUB_STEP_SUMMARY
echo "Review PR: ${{ steps.draft-changelog.outputs.pr_url }}" >> $GITHUB_STEP_SUMMARY
echo "(Optional): Review Draft Release: ${{ steps.draft-changelog.outputs.release_url }}" >> $GITHUB_STEP_SUMMARY
30 changes: 5 additions & 25 deletions .github/workflows/draft-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,21 @@ on:
inputs:
target:
description: "The owner/repo GitHub target"
required: true
branch:
description: "The branch to target (defaults to default branch)"
required: false
version_spec:
description: "New Version Spec"
default: "next"
release_url:
description: "The URL of the draft GitHub release"
required: false
post_version_spec:
description: "Post Version Specifier"
required: false
since:
description: "Use PRs with activity since this date or git reference"
required: false
since_last_stable:
description: "Use PRs with activity since the last stable git tag"
required: false
type: boolean
steps_to_skip:
description: "Comma separated list of steps to skip"
description: "comma-separated list of steps to skip"
required: false

jobs:
draft_release:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.10"]
env:
VERSION_SPEC: ${{ github.event.inputs.version_spec }}
POST_VERSION_SPEC: ${{ github.event.inputs.post_version_spec }}
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -48,11 +32,7 @@ jobs:
with:
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
target: ${{ github.event.inputs.target }}
branch: ${{ github.event.inputs.branch }}
version_spec: ${{ github.event.inputs.version_spec }}
post_version_spec: ${{ github.event.inputs.post_version_spec }}
since: ${{ github.event.inputs.since }}
since_last_stable: ${{ github.event.inputs.since_last_stable }}
release_url: ${{ github.event.inputs.release_url }}
steps_to_skip: ${{ github.event.inputs.steps_to_skip }}

- name: "** Next Step **"
Expand Down
Loading

0 comments on commit 2cd3e74

Please sign in to comment.