Skip to content

Commit 2e6d5e5

Browse files
committed
Remove prep release action and combine it with the release action and update the logic as well as update the release readme.
1 parent 62c6f61 commit 2e6d5e5

File tree

3 files changed

+69
-60
lines changed

3 files changed

+69
-60
lines changed

.github/workflows/prep-release.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 57 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,66 @@
1-
name: Release SDK
1+
name: Release Python SDKs
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "Version number"
8+
required: true
9+
type: string
10+
build_number:
11+
description: "Build number "
12+
required: true
13+
type: string
514

615
jobs:
7-
build_wheels:
16+
prepare-release:
17+
runs-on: ubuntu-latest
18+
if: startsWith(github.ref, 'refs/heads/sdk-core/') # Only run on branches that start with sdk-core/
19+
steps:
20+
- name: Checkout the code
21+
uses: actions/checkout@v4
22+
23+
- name: Import GPG key
24+
uses: crazy-max/ghaction-import-gpg@v6
25+
with:
26+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
27+
passphrase: ${{ secrets.PASSPHRASE }}
28+
git_user_signingkey: true
29+
git_commit_gpgsign: true
30+
31+
- name: Parse and Validate Inputs
32+
run: |
33+
# Get inputs passed to the workflow
34+
VERSION="${{ github.event.inputs.version }}"
35+
BUILD_NUMBER="${{ github.event.inputs.build_number }}"
36+
37+
# Save the parsed values for future steps
38+
echo "VERSION=$VERSION" >> $GITHUB_ENV
39+
echo "BUILD_NUMBER=$BUILD_NUMBER" >> $GITHUB_ENV
40+
shell: bash
41+
42+
- name: Run the Prep Release Script
43+
env:
44+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
run: |
46+
make prep-release VERSION="$VERSION" BUILD_NUMBER="$BUILD_NUMBER"
47+
shell: bash
48+
49+
build-wheels:
850
name: Build wheels for Python SDK on ${{ matrix.os }}
951
runs-on: ${{ matrix.os }}
1052
if: startsWith(github.ref, 'refs/heads/sdk-core/')
53+
needs: [prepare-release]
1154
strategy:
1255
fail-fast: false
1356
matrix:
1457
# macOS 13 is an Intel runner and macOS 14 is an Apple Silicon runner
1558
os: [ubuntu-22.04, ubuntu-22.04-arm, windows-latest, macos-13, macos-14]
1659
steps:
1760
- uses: actions/checkout@v4
61+
with:
62+
ref: ${{ github.ref }}
63+
1864
- name: Upgrade build dependencies
1965
run: python -m pip install --upgrade pip setuptools wheel
2066

@@ -32,7 +78,7 @@ jobs:
3278
CIBW_SKIP: pp* *-musllinux_*
3379
CIBW_MANYLINUX_X86_64_IMAGE: "quay.io/pypa/manylinux_2_34_x86_64"
3480
CIBW_MANYLINUX_AARCH64_IMAGE: "quay.io/pypa/manylinux_2_34_aarch64"
35-
CIBW_ARCHS: "native" # Equivalent to python's platform.machine()
81+
CIBW_ARCHS: "native"
3682
CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel"
3783
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel}"
3884
CIBW_TEST_REQUIRES: "pydantic pytest pytest-asyncio"
@@ -52,9 +98,12 @@ jobs:
5298
name: Build source distribution for Python SDK
5399
runs-on: ubuntu-latest
54100
if: startsWith(github.ref, 'refs/heads/sdk-core/')
101+
needs: [prepare-release]
55102
steps:
56103
- uses: actions/checkout@v4
57-
104+
with:
105+
ref: ${{ github.ref }}
106+
# Need to grab the SDK version for the wheel name
58107
- name: Extract SDK Version
59108
run: echo "SDK_VERSION=$(cat .VERSION)" >> "$GITHUB_ENV"
60109
shell: bash
@@ -77,14 +126,15 @@ jobs:
77126
name: onepassword-sdk-${{ env.SDK_VERSION }}
78127
path: ./dist/*.tar.gz
79128

80-
release-sdk:
129+
Release-SDK:
81130
runs-on: ubuntu-latest
82131
if: startsWith(github.ref, 'refs/heads/sdk-core/') # Only run on branches that start with sdk-core/
132+
needs: [build-wheels, build-sdist]
83133
steps:
84134
- name: Checkout the code
85135
uses: actions/checkout@v4
86136
with:
87-
token: ${{ secrets.PAT }}
137+
ref: ${{ github.ref }}
88138

89139
- name: Import GPG key
90140
uses: crazy-max/ghaction-import-gpg@v6
@@ -110,7 +160,7 @@ jobs:
110160
url: https://pypi.org/project/onepassword-sdk/
111161
permissions:
112162
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
113-
needs: [build_wheels, build-sdist]
163+
needs: [Release-SDK]
114164
steps:
115165
- uses: actions/download-artifact@v4
116166
with:

src/release/README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
1-
## How to Prepare a Release for the Python SDK
1+
# How to Release the Python SDK
22

3+
## Release off an Release Candidate Branch in Github Actions
4+
To release the Python SDK via Github Action, you must do the following:
5+
1. SDK core opens a new PR with the latest generated code and latest core. This branch should start off with `sdk-core/...`
6+
2. Add the release notes for the RC as well as update the examples if needed.
7+
3. Run the `Release Python SDKs` action and input the correct build and version number while referencing the RC branch.
8+
4. After the action is completed, the Python SDK is released on Github and PyPi, you can merge the PR branch.
9+
10+
If the Github Action isn't working, you can follow the manual steps below to release the Python SDK.
11+
12+
## Manual Steps to release a Python SDK
313
Before running this script, the user must make sure that they have the write permissions to the Python SDK repository.
414

515
Run this make command to install all dependencies required for the Python SDK release process.
@@ -10,7 +20,7 @@ release/install-dependencies
1020
Step 1. Make any changes to the SDK as required on a feature branch or main branch.
1121
NOTE: If ran on a main branch, a release branch will be created.
1222

13-
Step 2. Go to the root of the repo and run
23+
Step 2. Go to the root of the repo and run
1424
```
1525
make prep-release
1626
```

0 commit comments

Comments
 (0)