Skip to content

anna-money/workflow-tools

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

workflow-tools

Build Black Formatter GitHub License

CLI tools for GitHub Actions.

  • Automate writing GitHub workflow configs with a generator tool
  • Automate setting GitHub secrets for repositories
  • Integrate the tools into your pipeline for setting up new microservices

Rationale

Microservice architecture may have dozens and dozens of lookalikes services that require similar CI/CD workflows. With infrastructure as code approach taken by the GitHub Actions, why not using workflows generation? Setting up a new microservice repository may also be automated. This is where workflow-tools come in handy.

Examples

Let's set GitHub Secrets for a repository. First, get a personal access token in GitHub settings. Then set up a secret using workflow-tools:

workflow_secret --owner=anna-money --repo=workflow-tools \
  --token="YOUR-PERSONAL-ACCESS-TOKEN" \
  update --key=MY_SECRET_KEY --value=MY_VALUE

Now let's use a fragment of Jinja2 template for a GitHub Actions workflow to generate resulting config:

WORKFLOW_RUNNER_VERSION=ubuntu-18.04 WORKFLOW_PYTHON27=2.7 WORKFLOW_PYTHON37=3.7 \
workflow_generator
# Press Enter to start pasting Jinja2 workflow template into stdin
jobs:
  test:
    runs-on: [[ workflow.runner_version ]]
    strategy:
      matrix:
        python:
          - [[ workflow.python27 ]]
          - [[ workflow.python37 ]]
# Press Ctrl+D to render resulting workflow
# For real workflow templates use reading/writing from/to a file, load variables from envfile
jobs:
  test:
    runs-on: ubuntu-18.04
    strategy:
      matrix:
        python:
          - 2.7
          - 3.7

Help

See documentation for more details. Use --help flag for each tool in the package.

Installation

Just run:

pip install -U workflow-tools

Contributing

See CONTRIBUTING.rst.