Skip to content

Commit 6cd54f1

Browse files
author
Steven Silvester
authored
Merge pull request #182 from blink1073/refactor-ci
Refactor CI
2 parents 3c82022 + 6090e72 commit 6cd54f1

File tree

20 files changed

+204
-251
lines changed

20 files changed

+204
-251
lines changed

.github/actions/check-links/action.yml

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,19 @@ description: "Run a link check function for a repo"
33
runs:
44
using: "composite"
55
steps:
6+
- name: install-releaser
7+
uses: ./.github/actions/install-releaser
8+
9+
- name: Cache checked links
10+
uses: actions/cache@v2
11+
with:
12+
path: ~/.cache/releaser-link-check
13+
key: ${{ runner.os }}-releaser-linkcheck-${{ hashFiles('**/*.md', '**/*.rst') }}-links
14+
restore-keys: |
15+
${{ runner.os }}-releaser-linkcheck-
16+
617
- shell: bash
718
id: check-links
819
run: |
920
set -eux
10-
11-
# Set up env variables
12-
export RH_REPOSITORY=${GITHUB_REPOSITORY}
13-
export RH_REF=${GITHUB_REF}
14-
15-
if [ ! -z ${GITHUB_BASE_REF} ]; then
16-
echo "Using GITHUB_BASE_REF: ${GITHUB_BASE_REF}"
17-
export RH_BRANCH=${GITHUB_BASE_REF}
18-
else
19-
# e.g refs/head/foo or refs/tag/bar
20-
echo "Using GITHUB_REF: ${GITHUB_REF}"
21-
export RH_BRANCH=$(echo ${GITHUB_REF} | cut -d'/' -f 3-)
22-
fi
23-
24-
# Install Jupyter Releaser from git unless we are testing Releaser itself
25-
if ! command -v jupyter-releaser &> /dev/null
26-
then
27-
pip install -q git+https://github.com/jupyter-server/jupyter_releaser.git
28-
fi
29-
30-
jupyter-releaser prep-git
31-
jupyter-releaser check-links --force
21+
python -m jupyter_releaser.actions.check_links

.github/actions/check-release/action.yml

Lines changed: 26 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,40 +11,32 @@ inputs:
1111
runs:
1212
using: "composite"
1313
steps:
14-
- shell: bash
15-
id: draft-release
16-
run: |
17-
set -eux
14+
- name: install-releaser
15+
uses: ./.github/actions/install-releaser
1816

19-
# Set up env variables
20-
export GITHUB_ACCESS_TOKEN=${{ inputs.token }}
21-
export RH_REPOSITORY=${GITHUB_REPOSITORY}
22-
export RH_CHANGELOG=${{ inputs.changelog }}
23-
export RH_DRY_RUN=true
24-
export RH_REF=${GITHUB_REF}
17+
- name: draft-changelog
18+
uses: ./.github/actions/draft-changelog
19+
env:
20+
RH_IS_CHECK_RELEASE: "true"
21+
with:
22+
dry_run: true
23+
token: ${{ inputs.token }}
24+
changelog: ${{ inputs.changelog }}
2525

26-
if [ ! -z ${GITHUB_BASE_REF} ]; then
27-
echo "Using GITHUB_BASE_REF: ${GITHUB_BASE_REF}"
28-
export RH_BRANCH=${GITHUB_BASE_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
26+
- name: draft-release
27+
uses: ./.github/actions/draft-release
28+
env:
29+
RH_IS_CHECK_RELEASE: "true"
30+
with:
31+
dry_run: true
32+
token: ${{ inputs.token }}
33+
changelog: ${{ inputs.changelog }}
3434

35-
# Install Jupyter Releaser from git unless we are testing Releaser itself
36-
if ! command -v jupyter-releaser &> /dev/null
37-
then
38-
pip install -q git+https://github.com/jupyter-server/jupyter_releaser.git@v1
39-
fi
40-
41-
export RH_IS_CHECK_RELEASE=true
42-
43-
# Draft Changelog
44-
python -m jupyter_releaser.actions.draft_changelog
45-
46-
# Draft Release
47-
python -m jupyter_releaser.actions.draft_release
48-
49-
# Publish Assets
50-
jupyter-releaser publish-assets
35+
- name: publish-release
36+
uses: ./.github/actions/publish-release
37+
env:
38+
RH_IS_CHECK_RELEASE: "true"
39+
with:
40+
dry_run: true
41+
token: ${{ inputs.token }}
42+
release_url: ""

.github/actions/common/action.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: "Setup Releaser"
2+
description: "Common Actions to Set up Releaser"
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Install Python
7+
uses: actions/setup-python@v2
8+
with:
9+
python-version: 3.9
10+
architecture: "x64"
11+
12+
- name: Install node
13+
uses: actions/setup-node@v2
14+
with:
15+
node-version: "14.x"
16+
17+
- name: Get pip cache dir
18+
shell: bash
19+
id: pip-cache
20+
run: |
21+
echo "::set-output name=dir::$(pip cache dir)"
22+
23+
- name: Cache pip
24+
uses: actions/cache@v2
25+
with:
26+
path: ${{ steps.pip-cache.outputs.dir }}
27+
key: ${{ runner.os }}-pip-${{ hashFiles('setup.cfg') }}
28+
restore-keys: |
29+
${{ runner.os }}-pip-
30+
${{ runner.os }}-pip-
31+
32+
- name: Print env
33+
shell: bash
34+
run: env
35+
36+
- name: Upgrade packaging dependencies
37+
shell: bash
38+
run: |
39+
pip install --upgrade pip setuptools wheel --user
40+
41+
- name: Install Dependencies
42+
shell: bash
43+
run: |
44+
pip install -e .

.github/actions/draft-changelog/action.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ outputs:
3434
runs:
3535
using: "composite"
3636
steps:
37+
- name: install-releaser
38+
uses: ./.github/actions/install-releaser
39+
3740
- shell: bash
3841
id: draft-changelog
3942
run: |
@@ -48,12 +51,8 @@ runs:
4851
export RH_VERSION_SPEC=${{ inputs.version_spec }}
4952
export RH_CHANGELOG=${{ inputs.changelog }}
5053
export RH_DRY_RUN=${{ inputs.dry_run }}
51-
export RH_REF=${GITHUB_REF}
5254
export RH_SINCE=${{ inputs.since }}
5355
export RH_SINCE_LAST_STABLE=${{ inputs.since_last_stable }}
5456
55-
# Install Jupyter Releaser from git
56-
pip install -q git+https://github.com/jupyter-server/jupyter_releaser.git@v1
57-
5857
# Draft Changelog
5958
python -m jupyter_releaser.actions.draft_changelog

.github/actions/draft-release/action.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ outputs:
3838
runs:
3939
using: "composite"
4040
steps:
41+
- name: install-releaser
42+
uses: ./.github/actions/install-releaser
43+
4144
- shell: bash
4245
id: draft-release
4346
run: |
@@ -49,16 +52,12 @@ runs:
4952
if [ ! -z ${{ inputs.branch }} ]; then
5053
export RH_BRANCH=${{ inputs.branch }}
5154
fi
52-
export RH_REF=${GITHUB_REF}
5355
export RH_VERSION_SPEC=${{ inputs.version_spec }}
5456
export RH_POST_VERSION_SPEC=${{ inputs.post_version_spec }}
5557
export RH_DRY_RUN=${{ inputs.dry_run }}
5658
export RH_SINCE=${{ inputs.since }}
5759
export RH_SINCE_LAST_STABLE=${{ inputs.since_last_stable }}
5860
export RH_STEPS_TO_SKIP=${{ inputs.steps_to_skip }}
5961
60-
# Install Jupyter Releaser from git
61-
pip install -q git+https://github.com/jupyter-server/jupyter_releaser.git@v1
62-
6362
# Draft Release
6463
python -m jupyter_releaser.actions.draft_release
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: "Install Releaser"
2+
description: "Ensure Releaser is Installed"
3+
runs:
4+
using: "composite"
5+
steps:
6+
- shell: bash
7+
id: install-releaser
8+
run: |
9+
set -eux
10+
# Install Jupyter Releaser from git unless we are testing Releaser itself
11+
if ! command -v jupyter-releaser &> /dev/null
12+
then
13+
pip install -q git+https://github.com/jupyter-server/jupyter_releaser.git@v1
14+
fi

.github/actions/publish-release/action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ outputs:
2626
runs:
2727
using: "composite"
2828
steps:
29+
- name: install-releaser
30+
uses: ./.github/actions/install-releaser
31+
2932
- shell: bash
3033
id: publish-release
3134
run: |
@@ -37,8 +40,5 @@ runs:
3740
export release_url=${{ inputs.release_url }}
3841
export RH_STEPS_TO_SKIP=${{ inputs.steps_to_skip }}
3942
40-
# Install Jupyter Releaser from git
41-
pip install -q git+https://github.com/jupyter-server/jupyter_releaser.git@v1
42-
4343
# Publish release
4444
python -m jupyter_releaser.actions.publish_release

.github/workflows/check-release.yml

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,10 @@ jobs:
1515
steps:
1616
- name: Checkout
1717
uses: actions/checkout@v2
18-
- name: Install Python
19-
uses: actions/setup-python@v2
20-
with:
21-
python-version: 3.9
22-
architecture: "x64"
23-
- name: Install node
24-
uses: actions/setup-node@v2
25-
with:
26-
node-version: "14.x"
27-
- name: Get pip cache dir
28-
id: pip-cache
29-
run: |
30-
echo "::set-output name=dir::$(pip cache dir)"
31-
- name: Cache pip
32-
uses: actions/cache@v2
33-
with:
34-
path: ${{ steps.pip-cache.outputs.dir }}
35-
key: ${{ runner.os }}-pip-${{ hashFiles('setup.cfg') }}
36-
restore-keys: |
37-
${{ runner.os }}-pip-
38-
${{ runner.os }}-pip-
39-
- name: Print env
40-
run: env
41-
- name: Upgrade packaging dependencies
42-
run: |
43-
pip install --upgrade pip setuptools wheel --user
44-
- name: Install Dependencies
45-
run: |
46-
pip install -e .
18+
19+
- name: Setup
20+
uses: ./.github/actions/common
21+
4722
- name: Check Release
4823
uses: ./.github/actions/check-release
4924
with:

.github/workflows/draft-changelog.yml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,21 @@ jobs:
2727
steps:
2828
- name: Checkout
2929
uses: actions/checkout@v2
30-
- name: Install Python ${{ matrix.python-version }}
31-
uses: actions/setup-python@v2
32-
with:
33-
python-version: ${{ matrix.python-version }}
34-
architecture: "x64"
35-
- name: Install node
36-
uses: actions/setup-node@v2
37-
with:
38-
node-version: "14.x"
39-
- name: Upgrade packaging dependencies
40-
run: |
41-
pip install --upgrade pip setuptools wheel --user
30+
31+
- name: Setup
32+
uses: ./.github/actions/common
33+
4234
- name: Draft Changelog
4335
id: draft-changelog
44-
uses: jupyter-server/jupyter_releaser/.github/actions/draft-changelog@v1
36+
uses: ./.github/actions/draft-changelog
4537
with:
4638
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
4739
version_spec: ${{ github.event.inputs.version_spec }}
4840
target: ${{ github.event.inputs.target }}
4941
branch: ${{ github.event.inputs.branch }}
5042
since: ${{ github.event.inputs.since }}
5143
since_last_stable: ${{ github.event.inputs.since_last_stable }}
44+
5245
- name: "** Next Step **"
5346
run: |
5447
echo "Review PR: ${{ steps.draft-changelog.outputs.pr_url }}"

.github/workflows/draft-release.yml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,13 @@ jobs:
3636
steps:
3737
- name: Checkout
3838
uses: actions/checkout@v2
39-
- name: Install Python ${{ matrix.python-version }}
40-
uses: actions/setup-python@v2
41-
with:
42-
python-version: ${{ matrix.python-version }}
43-
architecture: "x64"
44-
- name: Install node
45-
uses: actions/setup-node@v2
46-
with:
47-
node-version: "14.x"
48-
- name: Upgrade packaging dependencies
49-
run: |
50-
pip install --upgrade pip setuptools wheel --user
39+
40+
- name: Setup
41+
uses: ./.github/actions/common
5142

5243
- name: Create Draft GitHub Release
5344
id: draft-release
54-
uses: jupyter-server/jupyter_releaser/.github/actions/draft-release@v1
45+
uses: ./.github/actions/draft-release
5546
with:
5647
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
5748
target: ${{ github.event.inputs.target }}
@@ -61,6 +52,7 @@ jobs:
6152
since: ${{ github.event.inputs.since }}
6253
since_last_stable: ${{ github.event.inputs.since_last_stable }}
6354
steps_to_skip: ${{ github.event.inputs.steps_to_skip }}
55+
6456
- name: "** Next Step **"
6557
run: |
6658
echo "Run the "Publish Release" Workflow with Release Url:"

0 commit comments

Comments
 (0)