From a720898c15e3c6b8e2640dc4338e1c863cfafcef Mon Sep 17 00:00:00 2001 From: Nick Schuch Date: Tue, 31 Oct 2023 11:27:23 +1000 Subject: [PATCH] Adds documentation --- README.md | 21 +++++++++++++- docs/preview.md | 76 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 docs/preview.md diff --git a/README.md b/README.md index 6906e14..0ff46ec 100644 --- a/README.md +++ b/README.md @@ -1 +1,20 @@ -# gh-workflows +# GitHub Actions Workflows + +This repository contains GitHub Action workflows to make it easy to automate your development pipeline. + +## Usage + +Example use below, see documentation for more [details](#documentation) on each workflow. + +```yaml +jobs: + my_job: + uses: skpr/gh-workflow/.github/workflows/workflow_file.yml@main + with: + input_a: abc + input_b: def +``` + +## Documentation + +* [Preview Environment](/docs/preview.md) - Create preview environments as part of a pull request workflow. diff --git a/docs/preview.md b/docs/preview.md new file mode 100644 index 0000000..b304bae --- /dev/null +++ b/docs/preview.md @@ -0,0 +1,76 @@ +# Preview Environment + +The following document outlines our Github Workflows which faciliate a preview environment deployment pipeline. + +## Required Secrets + +The following are secrets which are provided by a Skpr platform team member. + +* SKPR_PREVIEW_REGISTRY_URL +* SKPR_PREVIEW_REGISTRY_USERNAME +* SKPR_PREVIEW_REGISTRY_PASSWORD + +## Examples + +### Create Preview Environment + +Creates a preview environment as part of a pull request workflow. + +This workflow will: + +* Package the application using the same approach as `skpr package`. +* Deploy the application onto Preview environment infrastructure. +* Execute post deploy commands after the preview environment is deployed. + +```yaml +name: Create Preview Environment + +on: + pull_request: + types: [ synchronize, opened, reopened, ready_for_review ] + +concurrency: + group: preview-${{ github.head_ref }} + cancel-in-progress: true + +jobs: + deploy: + uses: skpr/gh-workflows/.github/workflows/preview-create.yml@main + secrets: + skpr_preview_registry_url: ${{ secrets.SKPR_PREVIEW_REGISTRY_URL }} + skpr_preview_username: ${{ secrets.SKPR_PREVIEW_USERNAME }} + skpr_preview_password: ${{ secrets.SKPR_PREVIEW_PASSWORD }} + with: + ref: ${{ github.event.pull_request.head.ref }} + eks_cluster_name: NEEDS TO BE CONFIGURED + k8s_namespace: NEEDS TO BE CONFIGURED + domain: NEEDS TO BE CONFIGURED + post_deploy_command: drush deploy +``` + +### Delete Preview Environment + +Deletes a preview environment when a pull request is closed or moved to a draft state. + +```yaml +name: Delete Preview Environment + +on: + pull_request: + types: [ closed, converted_to_draft ] + +concurrency: + group: preview-${{ github.head_ref }} + cancel-in-progress: true + +jobs: + deploy: + uses: skpr/gh-workflows/.github/workflows/preview-delete.yml@main + secrets: + skpr_preview_username: ${{ secrets.SKPR_PREVIEW_USERNAME }} + skpr_preview_password: ${{ secrets.SKPR_PREVIEW_PASSWORD }} + with: + ref: ${{ github.event.pull_request.head.ref }} + eks_cluster_name: NEEDS TO BE CONFIGURED + k8s_namespace: NEEDS TO BE CONFIGURED +```