salimkayabasi / example-github-flow-deployment

example repo for GHA and GitHub Flow

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

example-github-flow-deployment

Most of the software companies are using git as version control system. There are several ways of working with git. Initial purpose of having version control system for the codebase was having an identical and manageable code sharing between team members.

Nowadays, that is not enough for modern applications. We also need to consider testability, easy to deploy, and supporting multiple environments.

With this repo, I'll setup a basic demo for GitHub Flow + GitHub Actions

Steps

Start with protecting your main branch.

branch protection

Create a CI file under .github/workflows folder and .yml file with any name. I've started with hello-world example from GitHub.

Later on we need to set our triggers; We need a manual trigger for enabling us to choose any branch and set target to be deployed.

on:
  workflow_dispatch:
    inputs:
      environment:
        description: 'Name of environment to deploy'
        required: true
        default: 'Staging'

After merging these changes to main branch, we can trigger the pipeline with using any branch and target env name.

manual triggers

Let's run it against Staging env. Default value of ENVIRONMENT was Develop but it should be overridden as Staging.

setting new env name

echo env name

This flow creates ENVs automagically for us! Same goes for other ENVs once we created them.

env list

Advanced Features

So far, it was only for enabling us to have Cont. Development flow with multiple ENVs. What if we would like to have more control on what is being deployed and even setting more protections on flow.

ENV specific secrets

GitHub Secrets can be defined as level of Organization, Repository or even Environment.

repo secret

Some good articles

About

example repo for GHA and GitHub Flow