Skip to content

Commit f3cab75

Browse files
Add trusted publishing and self release (#544)
* Add trusted publishing and self release * Update .github/workflows/publish-self-release.yml Co-authored-by: Frédéric Collonval <[email protected]> --------- Co-authored-by: Frédéric Collonval <[email protected]>
1 parent b7fec70 commit f3cab75

File tree

2 files changed

+111
-0
lines changed

2 files changed

+111
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: "Step 1: Prep Self Release"
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version_spec:
6+
description: "New Version Specifier"
7+
default: "next"
8+
required: false
9+
branch:
10+
description: "The branch to target"
11+
required: false
12+
post_version_spec:
13+
description: "Post Version Specifier"
14+
required: false
15+
silent:
16+
description: "Set a placeholder in the changelog and don't publish the release."
17+
required: false
18+
type: boolean
19+
since:
20+
description: "Use PRs with activity since this date or git reference"
21+
required: false
22+
since_last_stable:
23+
description: "Use PRs with activity since the last stable git tag"
24+
required: false
25+
type: boolean
26+
jobs:
27+
prep_release:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v4
31+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
32+
- name: Install Dependencies
33+
shell: bash
34+
run: |
35+
pip install -e .
36+
- name: Prep Release
37+
id: prep-release
38+
uses: jupyter-server/jupyter_releaser/.github/actions/prep-release@v2
39+
with:
40+
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
41+
version_spec: ${{ github.event.inputs.version_spec }}
42+
post_version_spec: ${{ github.event.inputs.post_version_spec }}
43+
target: jupyter-server/jupyter_releaser
44+
branch: ${{ github.event.inputs.branch }}
45+
silent: ${{ github.event.inputs.silent }}
46+
since: ${{ github.event.inputs.since }}
47+
since_last_stable: ${{ github.event.inputs.since_last_stable }}
48+
49+
- name: "** Next Step **"
50+
run: |
51+
echo "Optional): Review Draft Release: ${{ steps.prep-release.outputs.release_url }}"
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: "Step 2: Publish Self Release"
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
branch:
6+
description: "The target branch"
7+
required: false
8+
release_url:
9+
description: "The URL of the draft GitHub release"
10+
required: false
11+
steps_to_skip:
12+
description: "Comma separated list of steps to skip"
13+
required: false
14+
15+
jobs:
16+
publish_release:
17+
runs-on: ubuntu-latest
18+
environment: release
19+
permissions:
20+
# This is useful if you want to use PyPI trusted publisher
21+
# and NPM provenance
22+
id-token: write
23+
steps:
24+
- uses: actions/checkout@v4
25+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
26+
- name: Install Dependencies
27+
shell: bash
28+
run: |
29+
pip install -e .
30+
- name: Populate Release
31+
id: populate-release
32+
uses: jupyter-server/jupyter_releaser/.github/actions/populate-release@v2
33+
with:
34+
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
35+
target: jupyter-server/jupyter_releaser
36+
branch: ${{ github.event.inputs.branch }}
37+
release_url: ${{ github.event.inputs.release_url }}
38+
steps_to_skip: ${{ github.event.inputs.steps_to_skip }}
39+
40+
- name: Finalize Release
41+
id: finalize-release
42+
env:
43+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
44+
uses: jupyter-server/jupyter_releaser/.github/actions/finalize-release@v2
45+
with:
46+
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
47+
target: ${{ github.event.inputs.target }}
48+
release_url: ${{ steps.populate-release.outputs.release_url }}
49+
50+
- name: "** Next Step **"
51+
if: ${{ success() }}
52+
run: |
53+
echo "Verify the final release"
54+
echo ${{ steps.finalize-release.outputs.release_url }}
55+
56+
- name: "** Failure Message **"
57+
if: ${{ failure() }}
58+
run: |
59+
echo "Failed to Publish the Draft Release Url:"
60+
echo ${{ steps.populate-release.outputs.release_url }}

0 commit comments

Comments
 (0)