Skip to content

Commit 8c5fb7d

Browse files
committed
Initial commit
0 parents  commit 8c5fb7d

39 files changed

+4104
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: "Check Release"
2+
description: "Run through a dry run release cycle"
3+
inputs:
4+
token:
5+
description: "GitHub access token"
6+
required: true
7+
changelog:
8+
description: "Changelog file"
9+
default: "CHANGELOG.md"
10+
required: false
11+
runs:
12+
using: "composite"
13+
steps:
14+
- shell: bash
15+
id: draft-release
16+
run: |
17+
set -eux
18+
19+
# Set up env variables
20+
export GITHUB_ACCESS_TOKEN=${{ inputs.token }}
21+
export RH_REPOSITORY=${GITHUB_REPOSITORY}
22+
export RH_VERSION_SPEC=0.0.1a0
23+
export RH_POST_VERSION_SPEC=0.1.0.dev0
24+
export RH_CHANGELOG=${{ inputs.changelog }}
25+
export RH_DRY_RUN=true
26+
if [ ! -z ${GITHUB_HEAD_REF} ]; then
27+
echo "Using GITHUB_HEAD_REF: ${GITHUB_HEAD_REF}"
28+
export RH_BRANCH=${GITHUB_HEAD_REF}
29+
else
30+
# e.g refs/head/foo or refs/tag/bar
31+
echo "Using GITHUB_REF: ${GITHUB_REF}"
32+
export RH_BRANCH=$(echo ${GITHUB_REF} | cut -d'/' -f 3)
33+
fi
34+
35+
# Install Jupyter Releaser from git unless we are testing Releaser itself
36+
export repo_name=$(echo ${GITHUB_REPOSITORY} | cut -d'/' -f 2)
37+
echo "repo name: ${repo_name}"
38+
if [ ${repo_name} != "jupyter_releaser" ]; then
39+
pip install git+https://github.com/jupyter-server/jupyter_releaser.git
40+
fi
41+
42+
# Draft Changelog
43+
python -m jupyter_releaser.actions.draft_changelog
44+
45+
# Draft Release
46+
python -m jupyter_releaser.actions.draft_release
47+
48+
- shell: bash
49+
id: publish-release
50+
run: |
51+
set -eux
52+
53+
# Set up env variables
54+
export release_url=${{ steps.draft-release.outputs.release_url }}
55+
export GITHUB_ACCESS_TOKEN=${{ inputs.token }}
56+
export RH_DRY_RUN=true
57+
58+
# Publish Release
59+
python -m jupyter_releaser.actions.publish_release ${release_url}
60+
61+
- shell: bash
62+
run: |
63+
set -eux
64+
65+
# Set up env variables
66+
export GITHUB_ACCESS_TOKEN=${{ inputs.token }}
67+
export release_url=${{ steps.publish-release.outputs.release_url }}
68+
69+
# Delete Draft Release
70+
jupyter-releaser delete-release ${release_url}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: "Draft Changelog"
2+
description: "Create an automated changelog entry PR"
3+
inputs:
4+
token:
5+
description: "GitHub access token"
6+
required: true
7+
version_spec:
8+
description: "New Version Specifier"
9+
required: true
10+
target:
11+
description: "The owner/repo GitHub target"
12+
required: true
13+
branch:
14+
description: The branch to target"
15+
required: false
16+
changelog:
17+
description: "Changelog file"
18+
default: "CHANGELOG.md"
19+
required: false
20+
dry_run:
21+
description: "If set, do not make a PR"
22+
default: "false"
23+
required: false
24+
outputs:
25+
pr_url:
26+
description: "The URL of the Changelog Pull Request"
27+
value: ${{ steps.draft-changelog.outputs.pr_url }}
28+
runs:
29+
using: "composite"
30+
steps:
31+
- shell: bash
32+
id: draft-changelog
33+
run: |
34+
set -eux
35+
36+
# Set up env variables
37+
export GITHUB_ACCESS_TOKEN=${{ inputs.token }}
38+
export RH_REPOSITORY=${{ inputs.target }}
39+
if [ ! -z ${{ inputs.branch }} ]; then
40+
export RH_BRANCH=${{ inputs.branch }}
41+
fi
42+
export RH_VERSION_SPEC=${{ inputs.version_spec }}
43+
export RH_CHANGELOG=${{ inputs.changelog }}
44+
export RH_DRY_RUN=${{ inputs.dry_run }}
45+
46+
# Draft Changelog
47+
pip install -q jupyter-releaser
48+
python -m jupyter_releaser.actions.draft_changelog
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: "Draft Release"
2+
description: "Create a draft GitHub Release"
3+
inputs:
4+
token:
5+
description: "GitHub access token"
6+
required: true
7+
target:
8+
description: "The owner/repo GitHub target"
9+
required: true
10+
branch:
11+
description: The branch to target"
12+
required: true
13+
version_spec:
14+
description: "New Version Specifier"
15+
required: true
16+
post_version_spec:
17+
description: "Post Version Specifier"
18+
required: false
19+
changelog:
20+
description: "Changelog file"
21+
default: "CHANGELOG.md"
22+
required: false
23+
dry_run:
24+
description: "If set, do not push permanent changes"
25+
default: "false"
26+
required: false
27+
outputs:
28+
release_url:
29+
description: "The html URL of the draft GitHub release"
30+
value: ${{ steps.draft-release.outputs.release_url }}
31+
runs:
32+
using: "composite"
33+
steps:
34+
- shell: bash
35+
id: draft-release
36+
run: |
37+
set -eux
38+
39+
# Set up env variables
40+
export GITHUB_ACCESS_TOKEN=${{ inputs.token }}
41+
export RH_REPOSITORY=${{ inputs.target }}
42+
if [ ! -z ${{ inputs.branch }} ]; then
43+
export RH_BRANCH=${{ inputs.branch }}
44+
fi
45+
export RH_VERSION_SPEC=${{ inputs.version_spec }}
46+
export RH_CHANGELOG=${{ inputs.changelog }}
47+
export RH_POST_VERSION_SPEC=${{ inputs.post_version_spec }}
48+
export RH_DRY_RUN=${{ inputs.dry_run }}
49+
50+
# Draft Release
51+
python -m jupyter_releaser.actions.draft_release
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: "Publish Release"
2+
description: "Publish assets and finalize GitHub release"
3+
inputs:
4+
token:
5+
description: "GitHub access token"
6+
required: true
7+
release_url:
8+
description: "The full url to the GitHub release page"
9+
required: true
10+
dry_run:
11+
description: "If set, do not push permanent changes"
12+
default: "false"
13+
required: false
14+
outputs:
15+
release_url:
16+
description: "The html URL of the GitHub release"
17+
value: ${{ steps.publish-release.outputs.release_url }}
18+
pr_url:
19+
description: "The html URL of the forwardport PR if applicable"
20+
value: ${{ steps.publish-release.outputs.pr_url }}
21+
runs:
22+
using: "composite"
23+
steps:
24+
- shell: bash
25+
id: publish-release
26+
run: |
27+
set -eux
28+
29+
# Set up env variables
30+
export GITHUB_ACCESS_TOKEN=${{ inputs.token }}
31+
export RH_DRY_RUN=${{ inputs.dry_run }}
32+
export release_url=${{ inputs.release_url }}
33+
34+
# Publish release
35+
pip install -q jupyter-releaser
36+
python -m jupyter_releaser.actions.publish_release

.github/workflows/cancel.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Cancel Prev Runs
2+
on:
3+
workflow_run:
4+
workflows: ["Tests", "Check Release"]
5+
types:
6+
- requested
7+
jobs:
8+
cancel:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: styfle/[email protected]
12+
with:
13+
workflow_id: ${{ github.event.workflow.id }}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Check Release
2+
on:
3+
push:
4+
branches: ["*"]
5+
jobs:
6+
check_release:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Cancel Previous Runs
10+
uses: styfle/[email protected]
11+
with:
12+
access_token: ${{ github.token }}
13+
- name: Checkout
14+
uses: actions/checkout@v1
15+
- name: Install Python
16+
uses: actions/setup-python@v1
17+
with:
18+
python-version: 3.9
19+
architecture: "x64"
20+
- name: Get pip cache dir
21+
id: pip-cache
22+
run: |
23+
echo "::set-output name=dir::$(pip cache dir)"
24+
- name: Cache pip
25+
uses: actions/cache@v1
26+
with:
27+
path: ${{ steps.pip-cache.outputs.dir }}
28+
key: ${{ runner.os }}-pip-${{ hashFiles('setup.cfg') }}
29+
restore-keys: |
30+
${{ runner.os }}-pip-
31+
${{ runner.os }}-pip-
32+
- name: Cache checked links
33+
uses: actions/cache@v2
34+
with:
35+
path: ~/.cache/pytest-link-check
36+
key: ${{ runner.os }}-linkcheck-${{ hashFiles('**/.md') }}-md-links
37+
restore-keys: |
38+
${{ runner.os }}-linkcheck-
39+
- name: Upgrade packaging dependencies
40+
run: |
41+
pip install --upgrade pip setuptools wheel --user
42+
- name: Install Dependencies
43+
run: |
44+
pip install -e .
45+
- name: Check Release
46+
env:
47+
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
48+
uses: ./.github/actions/check-release
49+
with:
50+
token: ${{ secrets.GH_TOKEN }}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Draft Changelog
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
target:
6+
description: "The owner/repo GitHub target"
7+
required: true
8+
branch:
9+
description: The branch to target"
10+
required: true
11+
version_spec:
12+
description: "New Version Spec"
13+
required: true
14+
jobs:
15+
changelog:
16+
runs-on: ubuntu-latest
17+
strategy:
18+
fail-fast: true
19+
matrix:
20+
python-version: ["3.9"]
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v1
24+
- name: Install Python ${{ matrix.python-version }}
25+
uses: actions/setup-python@v1
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
architecture: "x64"
29+
- name: Upgrade packaging dependencies
30+
run: |
31+
pip install --upgrade pip setuptools wheel --user
32+
- name: Install Dependencies
33+
run: |
34+
pip install -e .
35+
- name: Draft Changelog
36+
id: draft-changelog
37+
uses: ./.github/actions/draft-changelog
38+
with:
39+
token: ${{ secrets.GH_TOKEN }}
40+
version_spec: ${{ github.event.inputs.version_spec }}
41+
target: ${{ github.event.inputs.target }}
42+
branch: ${{ github.event.inputs.branch }}
43+
- name: "** Next Step **"
44+
run: |
45+
echo "Review PR: ${{ steps.draft-changelog.outputs.pr_url }}"
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Draft Release
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
target:
6+
description: "The owner/repo GitHub target"
7+
required: true
8+
branch:
9+
description: "The branch to target"
10+
required: true
11+
version_spec:
12+
description: "New Version Specifier"
13+
required: true
14+
post_version_spec:
15+
description: "Post Version Specifier"
16+
required: false
17+
jobs:
18+
release:
19+
runs-on: ubuntu-latest
20+
strategy:
21+
fail-fast: true
22+
matrix:
23+
python-version: ["3.9"]
24+
env:
25+
VERSION_SPEC: ${{ github.event.inputs.version_spec }}
26+
POST_VERSION_SPEC: ${{ github.event.inputs.post_version_spec }}
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v1
30+
- name: Install Python ${{ matrix.python-version }}
31+
uses: actions/setup-python@v1
32+
with:
33+
python-version: ${{ matrix.python-version }}
34+
architecture: "x64"
35+
- name: Upgrade packaging dependencies
36+
run: |
37+
pip install --upgrade pip setuptools wheel --user
38+
- name: Get pip cache dir
39+
id: pip-cache
40+
run: |
41+
echo "::set-output name=dir::$(pip cache dir)"
42+
- name: Cache pip
43+
uses: actions/cache@v1
44+
with:
45+
path: ${{ steps.pip-cache.outputs.dir }}
46+
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}
47+
restore-keys: |
48+
${{ runner.os }}-pip-${{ matrix.python-version }}-
49+
${{ runner.os }}-pip-
50+
- name: Install Dependencies
51+
run: |
52+
pip install -e .
53+
- name: Create Draft GitHub Release
54+
id: draft-release
55+
uses: ./.github/actions/draft-release
56+
with:
57+
token: ${{ secrets.GH_TOKEN }}
58+
target: ${{ github.event.inputs.target }}
59+
branch: ${{ github.event.inputs.branch }}
60+
version_spec: ${{ github.event.inputs.version_spec }}
61+
post_version_spec: ${{ github.event.inputs.post_version_spec }}
62+
- name: "** Next Step **"
63+
run: |
64+
echo "Run the "Publish Release" Workflow with Release Url:"
65+
echo ${{ steps.draft-release.outputs.release_url }}

0 commit comments

Comments
 (0)