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

Relook at the deploy-pre-release in develop volttron-core #36

Open
craig8 opened this issue Feb 7, 2025 · 3 comments
Open

Relook at the deploy-pre-release in develop volttron-core #36

craig8 opened this issue Feb 7, 2025 · 3 comments
Assignees

Comments

@craig8
Copy link
Contributor

craig8 commented Feb 7, 2025

GitHub Actions Workflow: Deploy Pre-Release Artifacts

This document outlines the GitHub Actions workflow designed to deploy pre-release artifacts for a project. The workflow is triggered by pushes to the develop branch and includes steps for setting up the environment, managing dependencies, version bumping, and publishing artifacts.

https://github.com/eclipse-volttron/volttron-core/blob/main/.github/workflows/deploy-pre-release.yml

hash 9d97589cad285adb8bca5c3593b8eabe9d04ddd2

Sequence Diagram

The sequence diagram below provides a visual representation of the workflow process using Mermaid.

sequenceDiagram
    actor GitHub
    participant Runner as GitHub Runner

    GitHub ->> Runner: Trigger on push to develop branch
    Runner ->> Runner: Echo event details
    note right of Runner: Set up environment
    Runner ->> Runner: Checkout code
    Runner ->> Runner: Setup Python
    Runner ->> Runner: Install Poetry
    note right of Runner: Dependency Management
    Runner ->> Runner: Load cached virtualenv
    alt Cache not hit
        Runner ->> Runner: Install dependencies
    end
    Runner ->> Runner: Install root library
    note right of Runner: Version Management
    Runner ->> Runner: Bump version to prerelease
    note right of Runner: Project Build
    Runner ->> Runner: Create build artifacts
    Runner ->> Runner: Release artifacts
    note right of Runner: Publish
    alt Repository owner is eclipse-volttron
        Runner ->> PyPI: Publish pre-release
    end
Loading

Workflow Overview

Workflow Name

  • Name: Deploy Pre-Release Artifacts
  • Trigger: Push events on the develop branch.

Environment Setup

  • Shell: Bash
  • Python Version: 3.10
  • Environment Variables:
    • LANG: en_US.utf-8
    • LC_ALL: en_US.utf-8

Workflow Steps and Description

1. Trigger

  • The workflow is triggered by a push event on the develop branch.

2. Setup Environment

  • Checkout Code:
    • Uses actions/[email protected] to pull code from the repository with complete history (fetch-depth: 0).
  • Setup Python:
    • Configures the desired Python version (3.10) using actions/setup-python@v2.
  • Install Poetry:
    • Installs Poetry with specific settings using snok/[email protected] to manage dependencies in a Python virtual environment.

3. Dependency Management

  • Load Cached Virtual Environment:
    • Uses actions/[email protected] to load cached dependencies if available, caching based on Python version and Poetry lock file.
  • Install Dependencies:
    • If the cache is not hit, Poetry installs project dependencies using poetry install --no-interaction --no-root.

4. Version Management

  • Bump Version:
    • Checks the latest tag, bumps the version using prerelease, or initializes it for the very first release as v0.0.1rc0.

5. Project Build

  • Create Build Artifacts:
    • Uses Poetry to build the project and generate distribution packages with poetry build -vvv.

6. Release and Publish

  • Release Artifacts:
    • Uses ncipollo/[email protected] to release the build artifacts, generate release notes, and create a pre-release tag.
  • Publish to PyPI:
    • Publishes the pre-release artifacts to PyPI if the repository owner is eclipse-volttron.

Environment Variables and Tokens

  • NEW_TAG: The new version tag generated during the bump version step.
  • GITHUB_TOKEN: GitHub token for authenticating API requests, used in the release action.
  • PYPI_TOKEN: Authentication token for publishing to PyPI, stored securely in secrets.

This workflow supports the CI/CD process by managing pre-release versions and automating the deployment, ensuring quality and consistency in the release cycle.

@schandrika
Copy link
Contributor

I propose we change the "bump version to prerelease" step of the above sequence diagram to use the version number in pyproject.toml as base, run "poetry version prerelease --no-interaction" to get the next version, auto-commit the modified pyproject.toml to develop branch and the release to pypi using the newly bumped version.
We can remove the old 10.0x tags in github

@schandrika
Copy link
Contributor

schandrika commented Feb 12, 2025

this is an example implementation of the proposed solution This needs to be updated to check if the source of the push is not a release branch or main.

@schandrika
Copy link
Contributor

Also do not run pre-release workflow if PR is marked as "documentation"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants