Skip to content

Commit a004bf2

Browse files
committed
Add prep-release and release and update wheels according to fork of Python SDK
1 parent 314cdc7 commit a004bf2

File tree

3 files changed

+103
-10
lines changed

3 files changed

+103
-10
lines changed

.github/workflows/prep-release.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Prep Release
2+
3+
on:
4+
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
14+
release_notes:
15+
description: "Release notes for the version"
16+
required: true
17+
type: string
18+
19+
jobs:
20+
prepare-release:
21+
runs-on: ubuntu-latest
22+
if: startsWith(github.ref, 'refs/heads/sdk-core/') # Only run on branches that start with sdk-core/
23+
steps:
24+
- name: Checkout the code
25+
uses: actions/checkout@v4
26+
27+
- name: Import GPG key
28+
uses: crazy-max/ghaction-import-gpg@v6
29+
with:
30+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
31+
git_user_signingkey: true
32+
git_commit_gpgsign: true
33+
git_tag_gpgsign: true
34+
- name: Setup Git User
35+
run: |
36+
git config --global user.email "${{ steps.import-gpg.outputs.email }}"
37+
git config --global user.name "${{ steps.import-gpg.outputs.name }}"
38+
39+
- name: Parse and Validate Inputs
40+
id: get_inputs
41+
run: |
42+
# Get inputs passed to the workflow
43+
VERSION="${{ github.event.inputs.version }}"
44+
BUILD_NUMBER="${{ github.event.inputs.build_number }}"
45+
echo -e "${{ github.event.inputs.RELEASE_NOTES }}" > src/release/RELEASE-NOTES
46+
47+
# Save the parsed values for future steps
48+
echo "VERSION=$VERSION" >> $GITHUB_ENV
49+
echo "BUILD_NUMBER=$BUILD_NUMBER" >> $GITHUB_ENV
50+
shell: bash
51+
52+
- name: Run the Prep Release Script
53+
env:
54+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
run: |
56+
make prep-release VERSION="$VERSION" BUILD_NUMBER="$BUILD_NUMBER"
57+
shell: bash

.github/workflows/release.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Release SDK
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
Release-SDK:
8+
runs-on: ubuntu-latest
9+
if: startsWith(github.ref, 'refs/heads/sdk-core/') # Only run on branches that start with sdk-core/
10+
steps:
11+
- name: Checkout the code
12+
uses: actions/checkout@v4
13+
- name: Import GPG key
14+
uses: crazy-max/ghaction-import-gpg@v6
15+
with:
16+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
17+
git_user_signingkey: true
18+
git_commit_gpgsign: true
19+
git_tag_gpgsign: true
20+
- name: Setup Git User
21+
run: |
22+
git config --global user.email "${{ steps.import-gpg.outputs.email }}"
23+
git config --global user.name "${{ steps.import-gpg.outputs.name }}"
24+
25+
- name: Run the Release Script
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
run: make release
29+
shell: bash

.github/workflows/wheels.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release Builder
1+
name: Wheels Builder and Publisher
22
on:
33
pull_request:
44
branches:
@@ -12,17 +12,21 @@ jobs:
1212
runs-on: ${{ matrix.os }}
1313
if: github.event.pull_request.merged == true && contains(github.event.pull_request.head.ref, 'sdk-core/')
1414
strategy:
15-
matrix:
16-
# macOS 13 is an Intel runner and macOS 14 is an Apple Silicon runner
15+
fail-fast: false
16+
matrix:
17+
# macOS 13 is an Intel runner and macOS 14 is an Apple Silicon runner
1718
os: [ubuntu-22.04, ubuntu-22.04-arm, windows-latest, macos-13, macos-14]
1819
steps:
1920
- uses: actions/checkout@v4
21+
- name: Upgrade build dependencies
22+
run: python -m pip install --upgrade pip setuptools wheel
23+
2024

2125
# Need to grab the SDK version for the wheel name
2226
- name: Extract SDK Version
2327
run: echo "SDK_VERSION=$(cat version.txt)" >> "$GITHUB_ENV"
2428
shell: bash
25-
29+
2630
- name: Install cibuildwheel
2731
run: |
2832
python -m pip install cibuildwheel
@@ -33,10 +37,13 @@ jobs:
3337
CIBW_MANYLINUX_X86_64_IMAGE: "quay.io/pypa/manylinux_2_34_x86_64"
3438
CIBW_MANYLINUX_AARCH64_IMAGE: "quay.io/pypa/manylinux_2_34_aarch64"
3539
CIBW_ARCHS: "native"
40+
CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel"
41+
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel}"
3642
CIBW_TEST_REQUIRES: "pydantic pytest pytest-asyncio"
43+
MACOSX_DEPLOYMENT_TARGET: "12.0"
3744
CIBW_TEST_COMMAND: "python -m pytest {project}/src/onepassword/test_client.py"
3845
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.TEST_SERVICE_ACCOUNT_TOKEN }}
39-
CIBW_ENVIRONMENT_PASS_LINUX: OP_SERVICE_ACCOUNT_TOKEN # to pass in the SA token, for some reason Linux doesn't read the env variables correctly
46+
CIBW_ENVIRONMENT_PASS_LINUX: OP_SERVICE_ACCOUNT_TOKEN # We have to specify this to pass the token to the test command
4047
run: |
4148
python -m cibuildwheel --output-dir dist
4249
@@ -55,13 +62,13 @@ jobs:
5562
- name: Extract SDK Version
5663
run: echo "SDK_VERSION=$(cat version.txt)" >> "$GITHUB_ENV"
5764
shell: bash
58-
65+
5966
- name: Install dependencies
6067
run: pip3 install build pydantic pytest pytest-asyncio
6168

6269
- name: Build source distribution
6370
run: python3 -m build --sdist
64-
71+
6572
- name: Test Source Distribution
6673
env:
6774
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.TEST_SERVICE_ACCOUNT_TOKEN }}
@@ -73,7 +80,7 @@ jobs:
7380
with:
7481
name: onepassword-sdk-${{ env.SDK_VERSION }}
7582
path: ./dist/*.tar.gz
76-
83+
7784
publish-to-pypi:
7885
name: Publish to PyPI
7986
runs-on: ubuntu-latest
@@ -82,13 +89,13 @@ jobs:
8289
name: pypi
8390
url: https://pypi.org/project/onepassword-sdk/
8491
permissions:
85-
id-token: write # Required for PyPi trusted publishing
92+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
8693
needs: [build_wheels, build-sdist]
8794
steps:
8895
- uses: actions/download-artifact@v4
8996
with:
9097
pattern: onepassword-sdk-*
9198
path: ./dist
9299
merge-multiple: true
93-
- name: Publish package distributions to PyPI
100+
- name: Publish package distributions to PyPi
94101
uses: pypa/gh-action-pypi-publish@release/v1.12

0 commit comments

Comments
 (0)