Zowe SDK Release #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Zowe SDK Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: Update project version before publish | |
required: false | |
type: string | |
dry-run: | |
description: Dry run mode | |
required: false | |
type: boolean | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
ref: ${{ github.ref }} | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip twine | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Update version | |
id: update-version | |
shell: python | |
run: | | |
import os, sys | |
sys.path.append("src") | |
from _version import __version__ | |
new_version = "${{ inputs.version }}" | |
if new_version: | |
with open("src/_version.py", 'w') as f: | |
f.write("__version__ = \"" + new_version + "\"\n") | |
else: | |
new_version = __version__ | |
with open(os.environ["GITHUB_OUTPUT"], 'a') as f: | |
print("version=" + ("-".join(new_version.rsplit(".", 1)) if new_version.count(".") > 2 else new_version), file=f) | |
- name: Update version (cargo) | |
run: cargo install cargo-edit && cargo set-version ${{ steps.update-version.outputs.version }} | |
working-directory: src/secrets | |
- name: Update version (git) | |
run: git add src/_version.py src/secrets/Cargo.* | |
- name: Build wheels | |
run: bash build.sh | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels | |
path: dist/ | |
- uses: zowe-actions/octorelease@v1 | |
env: | |
GIT_COMMITTER_NAME: ${{ secrets.ZOWE_ROBOT_USER }} | |
GIT_COMMITTER_EMAIL: ${{ secrets.ZOWE_ROBOT_EMAIL }} | |
GIT_CREDENTIALS: x-access-token:${{ secrets.ZOWE_ROBOT_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_ROBOT_TOKEN }} | |
with: | |
dry-run: ${{ inputs.dry-run }} | |
new-version: ${{ steps.update-version.outputs.version }} |