Giter VIP home page Giter VIP logo

n4b3ts3 / github_deploy Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 33 KB

Single script to deploy a release to github, the code for this is simple enough for anyone to read just a short file and then include it in its CD pipeline. Despite others options this project only depends on one script and the rest of files are just documentation or examples...

License: GNU General Public License v3.0

Shell 100.00%

github_deploy's Introduction

Github Deploy ๐Ÿถ

https://badgen.net/badge/Open%20Source%20%3F/Yes%21/blue?icon=github

How to use

First, create a file inside the ~/.github_deploy/ folder, for example, example.env Is very important the .env part if the file doesnt end with that it wont be recognized by the script. For security reasons you may need to use GPG in the .env file, for that please set the GPG_PROJECT environment to any value So lets say we have an original .env file like follows.

export GD_USERNAME=<your-username>
export PAT=<your-encrypted-pat>
export REPOSITORY=<your-repository>
export BRANCH=<your-target-branch>
export TAG=<vX.X.X>
export DESCRIPTION=<your-release-description>
export PRERELEASE=<true|false>
export GEN_PREREL_NOTES=<true|false>
export DRAFT=<true|false>

then we have to use the next over our previously created .env file:

gpg -r <your-key-id> -e <your-file>.env

the previous will create a file called example.env.gpg, PLEASE NOTE THAT IF THE FILE DOESNT ENDS WITH .env.gpg or .env THE SCRIPT IS NOT GOING TO RECOGNIZE IT Now, please delete the .env file for security reasons (SO NO ONE WITHOUT ACCESS TO YOUR GPG Key wont be able to access the release configurations) Finally, lets do as follows in your Jenkinsfile

pipeline{
    agent any
    stages{
        stage("Build"){
            steps{
                sh "echo Do your Build steps as you pleased"
            }
        }

        stage("Test"){
            steps{
                sh "echo Do your Test steps as you pleased"
            }
        }

        stage("Release"){
            steps{
                sh "export PROJECT_REGEX="<your-project-id>" && github_deploy.sh /path/to/my/build1 /path/to/my/build2 /path/to/my/buildn <<< <your-key-id>"
            }
        }

        stage("Deploy"){
            steps{
                sh "echo Do your Deploy steps as you pleased"
            }
        }
    }
}

for specifying a custom project to deploy you must set PROJECT_REGEX environment or variable when calling this script. This allow us to use the value of that var to create a custom regex matching the configuration file... You may also want to create a dynamic .env file in your project, for the purpose of updating your release descriptions or updating your tag name etc... for that purpose create a file using the syntax of KEY: VALUE like follow:

TAG: v1.0.3
DESCRIPTION: MY BEAUTIFUL DESCRIPTION WITHOUT NEW LINES PLEASE

The previous .env file can have any key described at the top of this README (at location ~/.github_deploy)

How to install

If you want to install this to your system please do as follows

wget https://github.com/n4b3ts3/github_deploy/releases/download/v1.0.3/github_deploy.zip
unzip github_deploy
mv `pwd`/github_deploy.sh /usr/local/bin/git-deploy

Maintainers

https://img.shields.io/badge/maintainer-n4b3ts3-blue

github_deploy's People

Contributors

n4b3ts3 avatar

Watchers

 avatar

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.