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

Enable release workflows to publish prerelease to PyPI #223

Merged
merged 2 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
67 changes: 67 additions & 0 deletions .github/workflows/dev-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Zowe SDK Release

on:
pull_request_target:
types:
- closed
branches:
- main

jobs:
release:
if: ${{ github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release-dev') }}
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
ref: main
token: ${{ secrets.ZOWE_ROBOT_TOKEN }}

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

- name: Increment dev version
id: update-version
shell: python
run: |
import sys
sys.path.append("src")
from _version import __version__
prerelease_tag = "dev"
tag_end_index = __version__.index(prerelease_tag) + len(prerelease_tag)
new_version = __version__[:tag_end_index] + str(int(__version__[tag_end_index:]) + 1)
with open("src/_version.py", 'w') as f:
f.write("__version__ = \"" + new_version + "\"\n")
print("::set-output name=version::" + new_version)
print("::set-output name=cargo-version::" + "-".join(new_version.rsplit(".", 1)))

- name: Increment dev version (cargo)
run: cargo install cargo-edit && cargo set-version ${{ steps.update-version.outputs.cargo-version }}
working-directory: src/secrets

- name: Build dist wheels
run: bash build.sh

- name: Commit version update
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: main
commit_message: "Bump version to ${{ steps.update-version.outputs.version }} [ci skip]"
commit_options: "--signoff"
commit_user_name: ${{ secrets.ZOWE_ROBOT_USER }}
commit_user_email: ${{ secrets.ZOWE_ROBOT_EMAIL }}
file_pattern: "src/_version.py src/secrets/Cargo.*"
tagging_message: v${{ steps.update-version.outputs.version }}

- name: Publish packages to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_ROBOT_TOKEN }}
69 changes: 0 additions & 69 deletions .github/workflows/dev-release.yaml.old

This file was deleted.

34 changes: 17 additions & 17 deletions .github/workflows/secrets-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,20 +125,20 @@ jobs:
name: wheels
path: src/secrets/dist

# release:
# name: Release
# runs-on: ubuntu-latest
# if: ${{ startsWith(github.ref, 'refs/tags/') }}
# needs: [linux, windows, macos, sdist]
# steps:
# - uses: actions/download-artifact@v3
# with:
# name: wheels
# - name: Publish to PyPI
# uses: PyO3/maturin-action@v1
# env:
# MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
# with:
# command: upload
# args: --non-interactive --skip-existing *
# working-directory: src/secrets
release:
name: Release
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') }}
needs: [linux, windows, macos, sdist]
steps:
- uses: actions/download-artifact@v3
with:
name: wheels
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_ROBOT_TOKEN }}
with:
command: upload
args: --non-interactive --skip-existing *
working-directory: src/secrets
2 changes: 1 addition & 1 deletion src/core/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"urllib3",
],
extras_require={
"secrets": [resolve_sdk_dep("secrets", "~=0.1.0")]
"secrets": [resolve_sdk_dep("secrets", "~=" + __version__)]
},
packages=find_namespace_packages(include=["zowe.*"]),
)
2 changes: 1 addition & 1 deletion src/secrets/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/secrets/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "keyring"
version = "0.1.0"
version = "1.0.0-dev10"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down