Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DEVOPS-1655] Build publish workflow for python sdk #558

Merged
Merged
Changes from 24 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
19f0e95
Add publish python workflow
michalchecinski Jan 26, 2024
4efe488
CHange
michalchecinski Jan 26, 2024
a9f2b66
add test publish
michalchecinski Jan 26, 2024
48ad8e9
Add newline
michalchecinski Jan 26, 2024
e4fee0c
Add secrets
michalchecinski Jan 26, 2024
39f8b9c
Fix version
michalchecinski Jan 26, 2024
1235737
Fix
michalchecinski Jan 26, 2024
9f1d2a9
Remove unzip
michalchecinski Jan 26, 2024
cff8aae
Fix
michalchecinski Jan 26, 2024
e81ba82
CHange dir
michalchecinski Jan 26, 2024
5fe1552
Download only bitwarden_sdk* artifacts
michalchecinski Jan 26, 2024
0cacf2c
Change for davidd6
michalchecinski Jan 26, 2024
4bc7a59
Fix
michalchecinski Jan 26, 2024
d83fc51
Fix regex
michalchecinski Jan 26, 2024
eec8046
Maybe fix
michalchecinski Jan 26, 2024
1f31851
Maybe fix
michalchecinski Jan 26, 2024
527e2b7
Move files to upper dir
michalchecinski Jan 26, 2024
f19aad6
Remove dirs
michalchecinski Jan 26, 2024
1810337
Fix
michalchecinski Jan 26, 2024
f44e5e3
Maybe fix
michalchecinski Jan 26, 2024
fb674d6
Fix working dir
michalchecinski Jan 26, 2024
0ab5245
Change
michalchecinski Jan 29, 2024
59aa4fb
Fix
michalchecinski Jan 29, 2024
eb2f93c
Merge branch 'main' into DEVOPS-1655-Build-publish-workflow-for-Pytho…
michalchecinski Jan 29, 2024
0f65e0c
Update .github/workflows/publish-python.yml
michalchecinski Jan 30, 2024
8c3317f
Add python to version bump
michalchecinski Jan 30, 2024
23a91ea
Merge branch 'main' into DEVOPS-1655-Build-publish-workflow-for-Pytho…
michalchecinski Jan 30, 2024
8138cb5
FIx
michalchecinski Jan 30, 2024
5cbc621
Merge branch 'DEVOPS-1655-Build-publish-workflow-for-Python-SDK' of h…
michalchecinski Jan 30, 2024
983df31
Fix
michalchecinski Jan 30, 2024
e600439
Merge branch 'main' into DEVOPS-1655-Build-publish-workflow-for-Pytho…
michalchecinski Jan 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 102 additions & 4 deletions .github/workflows/publish-python.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,111 @@
---
name: Publish Python SDK
run-name: Publish Python SDK ${{ inputs.release_type }}

on:
workflow_dispatch:
inputs:
release_type:
description: "Release Options"
required: true
default: "Release"
type: choice
options:
- Release
- Dry Run

defaults:
run:
shell: bash

jobs:
stub:
name: Stub
setup:
name: Setup
runs-on: ubuntu-22.04
steps:
- name: Stub
run: echo "Stub"
- name: Checkout repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Branch check
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
run: |
if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc" ]]; then
echo "==================================="
echo "[!] Can only release from the 'rc' or 'hotfix-rc' branches"
echo "==================================="
exit 1
fi

publish:
name: Publish
runs-on: ubuntu-22.04
needs: setup
steps:
- name: Install Python
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: "3.9"

- name: Install twine
run: pip install twine

- name: Download artifacts
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d # v3.0.0
with:
workflow: build-python-wheels.yml
path: ${{ github.workspace }}/target/wheels/dist
workflow_conclusion: success
branch: ${{ github.ref_name }}
name: bitwarden_sdk(.*)
name_is_regexp: true

- name: Dry Run - Download artifacts
if: ${{ github.event.inputs.release_type == 'Dry Run' }}
uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d # v3.0.0
with:
workflow: build-python-wheels.yml
path: ${{ github.workspace }}/target/wheels/dist
workflow_conclusion: success
branch: main
name: bitwarden_sdk(.*)
name_is_regexp: true
michalchecinski marked this conversation as resolved.
Show resolved Hide resolved

- name: Move files
working-directory: ${{ github.workspace }}/target/wheels/dist
run: |
find . -maxdepth 2 -type f -print0 | xargs -0 mv -t .
rm -rf */

- name: Login to Azure
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
with:
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}

- name: Retrieve pypi api token
id: retrieve-secret
uses: bitwarden/gh-actions/get-keyvault-secrets@main
with:
keyvault: "bitwarden-ci"
secrets: "pypi-api-token,
pypi-test-api-token"

- name: Check
working-directory: ${{ github.workspace }}/target/wheels
run: twine check dist/*

- name: Publish
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
working-directory: ${{ github.workspace }}/target/wheels
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ steps.retrieve-secret.outputs.pypi-api-token }}
run: twine upload --repository pypi dist/*

- name: Dry Run - Publish
if: ${{ github.event.inputs.release_type == 'Dry Run' }}
working-directory: ${{ github.workspace }}/target/wheels
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ steps.retrieve-secret.outputs.pypi-test-api-token }}
run: twine upload --repository testpypi dist/*
Loading