Skip to content

minvws/action-python-venv-package

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Python - venv package

  • This pipeline is designed to export a venv package for the specified Python version with the installed requirements. When Poetry is used, the requirements will be exported and the requirements will be installed in the venv.
  • The pipeline is designed to be as generic as possible, so they can be easily reused in any project.
  • This repository is a part of the generic GitHub Actions pipeline collection that can be used in any project.

Usage

Here are basic examples of how you can integrate it in your project.

Example workflow

This workflow is executed automatically on push of tags.

In the code below you need to replace the <python_version> and <package_file_name>. See the configuration section.

name: Build Python project

on:
  push:
    tags:
      - v*

jobs:
  venv-package:
    runs-on: ubuntu-latest
    steps:
      # Using the action
      - name: Build venv package
        uses: minvws/action-python-venv-package/.github/actions/python-venv-package@main
        with:
          python_version: <python_version>
          package_file_name: <package_file_name>
Example workflow self checkout

This workflow is executed automatically on the push of tags. The workflow will check out the repo and the action won't. Now it is possible to run additional actions before using the venv package action.

In the code below you need to replace the <python_version> and <package_file_name>. See the configuration section.

name: Build Python project

on:
  push:
    tags:
      - v*

jobs:
  venv-package:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      # Using the action
      - name: Build venv package
        uses: minvws/action-python-venv-package/.github/actions/python-venv-package@main
        with:
          python_version: <python_version>
          package_file_name: <package_file_name>
          checkout_repository: 'false'

Configuration

The action has inputs. The inputs are:

  • python_version: Semver version of the Python version you want to use. For example 3.11 or 3.9.
  • package_file_name: File name for the venv package. For example nl-example-package.
  • checkout_repository: Boolean value inside string to enable or disable checkout repository in the action. For example 'true' or 'false'. Default 'true'.
  • working_directory: Directory containing the Python project. The directory should contain a requirements.txt file or a pyproject.toml file. Default '.'.

Result

This action will create a .tar.gz file containing the .venv directory. The file will be available as an artifact.

The name of the artifact will be <package_file_name>_venv_<tag_version>_python<python_version>.tar.gz. For example nl-example-package_venv_v0.0.1_python3.9.tar.gz.

The uploaded artifact will have a limited lifetime depending on what is currently configured.

Contributing

If you want to contribute a new pipeline, please check the reusable workflow guidelines in the GitHub documentation.

About

Repo action-python-venv-package for minvws

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •