Install and Publish Specified Packages (Package Manager) #157
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: Install and Publish Specified Packages (Package Manager) | |
on: | |
workflow_dispatch: | |
inputs: | |
tag_name: | |
description: "The base tag for the release (e.g., v0.6.0)" | |
required: true | |
pre_release: | |
description: "The pre-release identifier (e.g., .dev1, .rc1, .alpha1)" | |
required: false | |
default: "" | |
jobs: | |
test: | |
env: | |
UNIQUE_VENV_PATH: "${{ github.workspace }}/.venv_core_${{ github.run_id }}" | |
runs-on: self-hosted | |
steps: | |
- name: Check Out Repository | |
uses: actions/checkout@v4 | |
- name: Set Up Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Extract Version from Tag | |
id: extract-version | |
run: | | |
FULL_TAG="${{ inputs.tag_name }}${{ inputs.pre_release }}" | |
echo "Full tag: $FULL_TAG" | |
# Remove the 'v' prefix if present and extract the version | |
VERSION=${FULL_TAG#v} | |
echo "Extracted version: $VERSION" | |
echo "version=$VERSION" >> $GITHUB_ENV | |
- name: Create and Activate Virtual Environment | |
run: | | |
python -m venv $UNIQUE_VENV_PATH | |
source $UNIQUE_VENV_PATH/bin/activate | |
- name: Install Poetry | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV | |
- name: Install toml | |
run: | | |
source $UNIQUE_VENV_PATH/bin/activate | |
pip install toml | |
- name: Set Version in pyproject.toml | |
run: | | |
source $UNIQUE_VENV_PATH/bin/activate | |
python scripts/manage_packages.py set-version --directory pkgs --version ${{ env.version }} | |
- name: Set Dependency Versions in pyproject.toml | |
run: | | |
source $UNIQUE_VENV_PATH/bin/activate | |
python scripts/manage_packages.py set-dependency-versions --directory pkgs --version ${{ env.version }} | |
- name: Generate poetry.lock | |
run: | | |
source $UNIQUE_VENV_PATH/bin/activate | |
python scripts/manage_packages.py poetry-lock --directory pkgs | |
- name: Install Dependencies | |
run: | | |
source $UNIQUE_VENV_PATH/bin/activate | |
python scripts/manage_packages.py poetry-install --directory pkgs --all-extras --dev | |
- name: Publish from Dependencies | |
run: | | |
source $UNIQUE_VENV_PATH/bin/activate | |
python scripts/manage_packages.py publish-from-dependencies --directory pkgs --username __token__ --password secret_password | |
- name: Show Installed Packages | |
run: | | |
source $UNIQUE_VENV_PATH/bin/activate | |
python scripts/manage_packages.py show-pip-freeze | |
- name: Clean Up Virtual Environment | |
if: always() | |
run: | | |
rm -rf ${{ env.UNIQUE_VENV_PATH }} |