Giter VIP home page Giter VIP logo

autodelivery's Introduction

Autodelivery

This action has been inspired by "Deploy Common Actions"

What it does

Updates common files and secrets across multiple repositories in one shot.

Exemplary use case

Imagine you got multiple repositories with the same continuous integration configuration (e.g., the same .travis.yml or github workflow files). Now, every time you want to make a change, you probably want to propagate it across the board. In the case you are propagating a GitHub Actions workflow, you are presumably also setting up signign keys and similar stuff. And doing it requires precious time to be spent for a repetitive action: unacceptable. This action is here to help.

Action inputs and configuration

  • token: Github secret token. Must be a user token, GH Actions tokens won't work. You need at least public_repo to work with private repositories and repo to work with private repositories. In case you want to push changes to your GitHub Actions workflows, also check the workflows permission.
  • user: GitHub username of the user performing the delivery. Defaults internally to GITHUB_ACTOR in case it's unspecified
  • configuration_file: Path to the Autodelivery YAML configuration file (whose syntax is described later on), relative to the local repository root. Defaults to 'auto-delivery.yml'
  • commit_author: Committer's name. Defaults to Autodelivery [bot]
  • author_email: Commiter's email. Defaults to [email protected]
  • labels: Comma separated list of labels to apply to the pull request. Defaults to ''. Non existing labels will be created using the color in colors (if a color positionally matches the label) or generating a random color.
  • colors: Comma separated list of colors, in HTML format (six hexadecimal entries, e.g., 'fa1234')

This action has no outputs.

Repository structure

You are expected to define one payload per folder. The contents of the folder will be copied inside the target repositories defined in the YAML configuration file.

.
├── .github/workflow/deploy.yml # Your workflow to deploy the script, as shown in the example below.
├── my-common-travis-stuff # A common workflow 
|   └──  .travis.yml
├── some-standard-gradle-project # A common workflow 
|   └── gradle
|   |   ├── wrapper.jar
|   |   └── gradle-wrapper.properties
|   ├── build.gradle.kts
|   └── settings.gradle.kts
├── a-github-actions-example # A common workflow 
|   └── .github
|       └── workflows
|           ├── my-action-1.yml
|           └── my-action-2.yml
└── auto-delivery.yml

Propagating secrets

Secrets propagation is performed using environment variables: the secret you want to propagate must be available in the repository hosting this action (of course, otherwise it would be impossible to access) into an environment variable with the same name of the target secret variable.

YAML configuration file

The YAML configuration file tells Autodelivery where to deliver which subfolder. For the previous example, the file might look like something like this:

files:
  my-common-travis-stuff: # same as the folder name
    owner1: # Can be a user or an organization
      repo1: # Repository name. If no branch is specified, the default is 'master'
      repo2: develop # A branch can be specified with a string
      repo3: # Multiple branches can be targeted by using a list
        - master
        - develop
    owner2: repo1 # If you got a single repo you care of, and the master branch is fine, then just use a string
  some-standard-gradle-project:
    someuser: a-gradle-repository
  a-github-actions-example:
    my-organization:
      a-repository-using-actions: develop
      another-repository-but-with-master-as-development-branch:
    another-user-or-organization:
      yeah-you-got-how-it-works: master
secrets:
  MY_SECRET_VARIABLE: # Must be an environment variable that is available when the action is performed
    some-owner: some-repository
    same-syntax-as-files: you-can-be-DRY-using-anchors-and-merge-keys

GitHub Action

In order to use this action to automate the delivery, use a configuration such as:

name: Autodelivery
on:
  push:
jobs:
  autodelivery:
    runs-on: ubuntu-latest
    steps:
    - uses: DanySK/autodelivery@master # Replace with a version!
      with:
        # You can omit everything but token (mandatory) and user (recommended) if you are okay with the defaults
        token: ${{ secrets.GH_TOKEN }}
        user: DanySK
        configuration_file: 'auto-delivery.yml'
        commit_author: Danilo Pianini
        author_email: [email protected]

Running example

Since it's easier done that said, and since I use this myself for my repositories, here is an example.

autodelivery's People

Contributors

danysk avatar mikehamilton-rw avatar renovate[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

autodelivery's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

bundler
Gemfile
  • faraday "~>1.1.0"
  • git "~> 1.7.0"
  • octokit "~> 4.0"
  • rbnacl "~> 7.1.1"
  • values "~> 1.8.0"
dockerfile
Dockerfile
  • ruby 2.7.2
github-actions
.github/workflows/build-and-deploy-docker-linux-container.yml
  • actions/checkout v2
  • ncipollo/release-action v1

  • Check this box to trigger a request for Renovate to run again on this repository

Support a richer configuration

If GHA allows for it, this could work with a list of <owner, repo, branch> triples for each subfolder, so that everything's updated in a single shot

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.