github-actions-serverless-pipeline
v0.0.6
Published
A serverless pipeline for GitHub Actions
Downloads
500
Maintainers
Readme
GitHub Actions Serverless CI/CD Pipeline Setup
A simple GitHub actions serverless pipeline setup for a simple serverless function.
Installation
- Run
npm install github-actions-serverless-pipeline
into your app and then follow the steps.
Dependency
- This package expects that all the build procedures or commands are written in a single
Makefile
file and that theMakefile
is located in the root of the project. - A sample file is attached to this package, and you can use it as a template.
Post Installation Steps
- Open your
github-actions-setup.yml
from.github/workflows/
directory. - Since this is a hidden folder, make sure it is visible in your editor or file explorer.
- Replace the following :
withname: github-actions-setup
name: <your-unique-github-actions-setup-name>
- Replace the following :
withbranches: [ master ]
branches: [ <your-branch-name> ]
- That's it! Push the changes to your branch, and you are ready to go.
How to read github-actions-setup.yml file?
Check your github-actions-setup.yml
file in .github/workflows/
directory to understand what all steps you need to set up.
Make sure you have added AWS secrets to your specific repository or organization.
Make sure you have a make file
in your project root directory which has all the commands to build your project.
Comment / Uncomment the following snippet if you don't need to install PHP or customize it as per your need. Use this to install any language or package you need.
Comment / Uncomment the following snippet if you don't need any Laravel Mix package to build production assets.
This section sets up the node environment for you to run npm commands.
This step allows you to read files at your root directory or local directory such as we use make
file
Private package repository in GitHub Actions
- Generate a new SSH key with sufficient access privileges. For security reasons, don't use your personal SSH key but set up a dedicated one for use in GitHub Actions. See below for a few hints if you are unsure about this step.
- Make sure you don't have a passphrase set on the private key.
- Add the public SSH key to the private repository you are pulling from during the Github Action as a 'Deploy Key'.
- Add the private SSH key to the repository triggering the Github Action:
- In your repository, go to the Settings > Secrets menu and create a new secret. In this example, we'll call it SSH_PRIVATE_KEY.
- Put the contents of the private SSH key file into the contents field.
- This key should start with -----BEGIN ... PRIVATE KEY-----, consist of many lines and ends with -----END ... PRIVATE KEY-----.
- In your workflow definition file, add the following step. Preferably this would be rather on top, near the actions/checkout@v2 line.
Customization
You can easily customize the deployment process by adding your own commands to the Makefile
file.
Author
Sagar Chauhan works as a Project Manager - Technology at Greenhonchos. In his spare time, he hunts bug as a Bug Bounty Hunter. Follow him at Instagram, Twitter, Facebook, Github
License
MIT