diff --git a/README.md b/README.md index 6699b198..9ceae2f2 100644 --- a/README.md +++ b/README.md @@ -1 +1,64 @@ # Github Action Composite +This is main of Composite GitHub Actions. +- build +- deploy +- rollback +- destroy (dev release) + +# Basic Usage +You can choose 2 option strategy. + +Option 1: Single Job +``` +jobs: + build-push-deploy: + runs-on: k8s-runner + + steps: + - name: Build + uses: kitabisa/composite-actions/build/backend@v1 + with: + gh_user: ${{ secrets.GH_USER }} + gh_token: ${{ secrets.GH_TOKEN }} + ..................... + + + - name: Deploy + uses: kitabisa/composite-actions/deploy/backend@v1 + with: + env: ${{ env.ENV }} + gh_token: ${{ secrets.GH_TOKEN }} + project_id: ${{ secrets.GCP_PROJECT_ID_PROD }} + ..................... + +``` + + +Option 2: Multiple Job +``` +jobs: + build-push: + runs-on: k8s-runner + steps: + - name: Run build & push + uses: kitabisa/composite-actions/build/frontend@v1 + with: + project_id: ${{ secrets.GCP_PROJECT_ID_PROD }} + credentials_json: ${{ secrets.GCP_SA_KEY_PROD }} + gcr_host: ${{ secrets.GCR_HOST }} + ..................... + + + deploy: + runs-on: k8s-runner + needs: build-push + steps: + - name: Run deploy & prune + uses: kitabisa/composite-actions/deploy/frontend@v1 + with: + project_id: ${{ secrets.GCP_PROJECT_ID_PROD }} + credentials_json: ${{ secrets.GCP_SA_KEY_PROD }} + gcr_host: ${{ secrets.GCR_HOST }} + ..................... + +``` diff --git a/build/backend/README.md b/build/backend/README.md new file mode 100644 index 00000000..4b444684 --- /dev/null +++ b/build/backend/README.md @@ -0,0 +1,37 @@ + +## Description + +Build and push docker image + + + +## Inputs + +| parameter | description | required | default | +| --- | --- | --- | --- | +| gh_user | gh user | `true` | | +| gh_token | gh token | `true` | | +| cache_dependency_path | go sum location | `false` | go.sum | +| go_version | go version | `false` | ^1.13.1 | +| build | Run make build | `false` | true | +| build_push_image | build and push image for deployment | `false` | false | +| build_push_image_swagger | build and push image for swagger | `false` | false | +| build_push_image_mockoon | build and push image for mockoon | `false` | | +| credentials_json | GCP credentials services account | `false` | | +| project_id | GCP project id | `false` | | +| gcr_host | GCP container registry host | `false` | | +| swagger_script_path | swagger script path | `false` | | +| openapi_input_file | openapi input file | `false` | | +| openapi_output_file | openapi output file | `false` | | +| working_directory | Set working directory | `false` | . | + + + + + + + +## Runs + +This action is a `composite` action. + diff --git a/build/frontend/README.md b/build/frontend/README.md new file mode 100644 index 00000000..c530f544 --- /dev/null +++ b/build/frontend/README.md @@ -0,0 +1,51 @@ + +## Description + +Frontend composite deployment + + + +## Inputs + +| parameter | description | required | default | +| --- | --- | --- | --- | +| install | Run make install | `false` | true | +| config | Run make config | `false` | true | +| build | Run make build | `false` | true | +| package | Run make package | `false` | true | +| cache | Run action cache | `false` | true | +| project_id | GCP project id | `true` | | +| credentials_json | GCP credentials services account | `true` | | +| gcr_host | GCP container registry host | `true` | | +| setup_pnpm | Setup pnpm and cache modules | `false` | false | +| setup_yarn | Setup yarn and cache modules | `false` | false | +| chartmuseum_host | ChartMuseum host | `true` | | +| chartmuseum_user | ChartMuseum user | `true` | | +| chartmuseum_pass | ChartMuseum password | `true` | | +| working_directory | Set working directory | `false` | . | +| pnpm_version | Setup pnpm version | `false` | latest | +| using_nextjs | Setup next.js cache modules | `false` | false | +| using_cdn | Setup cdn for static assets | `false` | false | +| delete_oldest_cdn | Setup delete oldest cdn | `false` | true | +| cdn_aws_s3_bucket | CDN aws s3 bucket | `false` | | +| cdn_aws_access_key_id | CDN aws access key id | `false` | | +| cdn_aws_secret_access_key | CDN aws secret access key | `false` | | +| cdn_aws_region | CDN aws region | `false` | | +| cdn_source_dir | CDN source dir | `false` | | +| cdn_dest_dir | CDN dest dir | `false` | | +| cdn_keep_latest_version | CDN keep latest version length | `false` | 2 | + + + +## Outputs + +| parameter | description | +| --- | --- | +| build-time | Define build time | + + + +## Runs + +This action is a `composite` action. + diff --git a/build/static/README.md b/build/static/README.md new file mode 100644 index 00000000..23368b7a --- /dev/null +++ b/build/static/README.md @@ -0,0 +1,29 @@ + +## Description + +Static web composite deployment + + + +## Inputs + +| parameter | description | required | default | +| --- | --- | --- | --- | +| project_id | GCP project id | `true` | | +| credentials_json | GCP credentials services account | `true` | | +| gcr_host | GCP container registry host | `true` | | +| chartmuseum_host | ChartMuseum host | `true` | | +| chartmuseum_user | ChartMuseum user | `true` | | +| chartmuseum_pass | ChartMuseum password | `true` | | +| working_directory | Set working directory | `false` | . | + + + + + + + +## Runs + +This action is a `composite` action. + diff --git a/deploy/ansible/README.md b/deploy/ansible/README.md new file mode 100644 index 00000000..a785bf70 --- /dev/null +++ b/deploy/ansible/README.md @@ -0,0 +1,25 @@ + +## Description + +Run Ansible Playbooks + + + +## Inputs + +| parameter | description | required | default | +| --- | --- | --- | --- | +| path | Ansible Playbook path | `true` | | +| ssh_private_key | SSH Private Key | `true` | | +| vault_password | Vault password | `false` | | + + + + + + + +## Runs + +This action is a `composite` action. + diff --git a/deploy/backend/README.md b/deploy/backend/README.md new file mode 100644 index 00000000..e18352ea --- /dev/null +++ b/deploy/backend/README.md @@ -0,0 +1,37 @@ + +## Description + +Build and push docker image + + + +## Inputs + +| parameter | description | required | default | +| --- | --- | --- | --- | +| env | environment to deploy to | `true` | dev | +| gh_token | gh token | `true` | | +| project_id | GCP project id | `true` | | +| gcr_host | GCP container registry host | `true` | | +| chartmuseum_host | ChartMuseum host | `true` | | +| chartmuseum_user | ChartMuseum user | `true` | | +| chartmuseum_pass | ChartMuseum password | `true` | | +| gke_cluster_name | GKE cluster name | `true` | | +| gke_cluster_zone | GKE cluster location zone | `true` | | +| rancher_host | Rancher host | `true` | | +| rancher_access_key | Rancher access key | `true` | | +| rancher_secret_key | Rancher secret key | `true` | | +| rancher_cluster_id | Rancher cluster id | `true` | | +| working_directory | Set working directory | `false` | . | +| setup_helmfiles | Setup helmfiles | `false` | false | + + + + + + + +## Runs + +This action is a `composite` action. + diff --git a/deploy/frontend/README.md b/deploy/frontend/README.md new file mode 100644 index 00000000..6c0afb50 --- /dev/null +++ b/deploy/frontend/README.md @@ -0,0 +1,37 @@ + +## Description + +Frontend composite deployment + + + +## Inputs + +| parameter | description | required | default | +| --- | --- | --- | --- | +| project_id | GCP project id | `true` | | +| credentials_json | GCP credentials services account | `true` | | +| gcr_host | GCP container registry host | `true` | | +| chartmuseum_host | ChartMuseum host | `true` | | +| chartmuseum_user | ChartMuseum user | `true` | | +| chartmuseum_pass | ChartMuseum password | `true` | | +| gke_cluster_name | GKE cluster name | `true` | | +| gke_cluster_zone | GKE cluster location zone | `true` | | +| rancher_host | Rancher host | `true` | | +| rancher_access_key | Rancher access key | `true` | | +| rancher_secret_key | Rancher secret key | `true` | | +| rancher_cluster_id | Rancher cluster id | `true` | | +| working_directory | Set working directory | `false` | . | +| preview_url | Set preview url | `false` | | +| prune | Run make prune | `false` | false | + + + + + + + +## Runs + +This action is a `composite` action. + diff --git a/deploy/terragrunt/README.md b/deploy/terragrunt/README.md new file mode 100644 index 00000000..dc33ab68 --- /dev/null +++ b/deploy/terragrunt/README.md @@ -0,0 +1,26 @@ + +## Description + +Run Terragrunt Plan & Apply + + + +## Inputs + +| parameter | description | required | default | +| --- | --- | --- | --- | +| path | Terragrunt path | `true` | | +| git_user | Git login user | `true` | | +| git_token | Git token access | `true` | | +| gcp_credentials | GCP credentials | `false` | | + + + + + + + +## Runs + +This action is a `composite` action. + diff --git a/destroy/README.md b/destroy/README.md new file mode 100644 index 00000000..c338aa51 --- /dev/null +++ b/destroy/README.md @@ -0,0 +1,35 @@ + +## Description + +Destroy release deployment + + + +## Inputs + +| parameter | description | required | default | +| --- | --- | --- | --- | +| working_directory | Set working directory | `false` | . | +| credentials_json | GCP credentials services account | `true` | | +| gke_cluster_name | GKE cluster name | `true` | | +| gke_cluster_zone | GKE cluster location zone | `true` | | +| gcr_host | GCP container registry host | `true` | | +| project_id | GCP project id | `true` | | +| prune_all | make prune-all | `false` | false | +| using_cdn | Setup cdn for static assets | `false` | false | +| delete_oldest_cdn | Setup delete oldest cdn | `false` | true | +| cdn_aws_s3_bucket | CDN aws s3 bucket | `false` | | +| cdn_aws_access_key_id | CDN aws access key id | `false` | | +| cdn_aws_secret_access_key | CDN aws secret access key | `false` | | +| cdn_aws_region | CDN aws region | `false` | | + + + + + + + +## Runs + +This action is a `composite` action. + diff --git a/packages/buildx/README.md b/packages/buildx/README.md new file mode 100644 index 00000000..e9df6c74 --- /dev/null +++ b/packages/buildx/README.md @@ -0,0 +1,25 @@ + +## Description + +Setup Docker buildx credentials & cache + + + +## Inputs + +| parameter | description | required | default | +| --- | --- | --- | --- | +| project_id | GCP project id | `true` | | +| gcr_host | GCP container registry host | `true` | | +| cache | Run action cache | `false` | true | + + + + + + + +## Runs + +This action is a `composite` action. + diff --git a/packages/cdn/README.md b/packages/cdn/README.md new file mode 100644 index 00000000..4f0a9b15 --- /dev/null +++ b/packages/cdn/README.md @@ -0,0 +1,30 @@ + +## Description + +Manage CDN static for upload or delete + + + +## Inputs + +| parameter | description | required | default | +| --- | --- | --- | --- | +| working_directory | Set working directory | `false` | . | +| cdn_aws_s3_bucket | CDN aws s3 bucket | `true` | | +| cdn_aws_access_key_id | CDN aws access key id | `true` | | +| cdn_aws_secret_access_key | CDN aws secret access key | `true` | | +| cdn_aws_region | CDN aws region | `true` | | +| cdn_source_dir | CDN source dir | `false` | | +| upload | Upload dir | `false` | | +| delete | Delete dir | `false` | | + + + + + + + +## Runs + +This action is a `composite` action. + diff --git a/packages/gcloud/README.md b/packages/gcloud/README.md new file mode 100644 index 00000000..54e7b96c --- /dev/null +++ b/packages/gcloud/README.md @@ -0,0 +1,24 @@ + +## Description + +Frontend composite deployment + + + +## Inputs + +| parameter | description | required | default | +| --- | --- | --- | --- | +| project_id | GCP project id | `true` | | +| credentials_json | GCP credentials services account | `true` | | + + + + + + + +## Runs + +This action is a `composite` action. + diff --git a/packages/gke-credential/README.md b/packages/gke-credential/README.md new file mode 100644 index 00000000..1ee24cbf --- /dev/null +++ b/packages/gke-credential/README.md @@ -0,0 +1,25 @@ + +## Description + +Get GKE Credential + + + +## Inputs + +| parameter | description | required | default | +| --- | --- | --- | --- | +| project_id | GCP project id | `true` | | +| gke_cluster_name | GKE cluster name | `true` | | +| gke_cluster_zone | GKE cluster location zone | `true` | | + + + + + + + +## Runs + +This action is a `composite` action. + diff --git a/packages/makefile/README.md b/packages/makefile/README.md new file mode 100644 index 00000000..b8ddc87d --- /dev/null +++ b/packages/makefile/README.md @@ -0,0 +1,48 @@ + +## Description + +Makefile build push deploy + + + +## Inputs + +| parameter | description | required | default | +| --- | --- | --- | --- | +| project_id | GCP project id | `false` | | +| gcr_host | GCP container registry host | `false` | | +| chartmuseum_host | ChartMuseum host | `false` | | +| chartmuseum_user | ChartMuseum user | `false` | | +| chartmuseum_pass | ChartMuseum password | `false` | | +| install | make install | `false` | false | +| config | make config | `false` | false | +| build | make build | `false` | false | +| package | make package | `false` | false | +| deploy | make deploy | `false` | false | +| rollback | make rollback | `false` | false | +| rollback_release | rollback release | `false` | | +| rollback_revision | rollback revision | `false` | | +| prune | make prune | `false` | false | +| prune_all | make prune-all | `false` | false | +| destroy | make destroy | `false` | false | +| working_directory | Set working directory | `false` | . | +| using_cdn | Setup cdn for static assets | `false` | false | +| cdn_keep_latest_version | CDN keep latest version length | `false` | 2 | +| setup_helmfiles | Setup helmfiles | `false` | true | + + + +## Outputs + +| parameter | description | +| --- | --- | +| build-time | Define build time | +| cdn-upload-path | Define cdn upload path | +| cdn-delete-path | Define cdn delete path | + + + +## Runs + +This action is a `composite` action. + diff --git a/packages/pnpm/README.md b/packages/pnpm/README.md new file mode 100644 index 00000000..9601fbcf --- /dev/null +++ b/packages/pnpm/README.md @@ -0,0 +1,26 @@ + +## Description + +Setup pnpm & cache modules + + + +## Inputs + +| parameter | description | required | default | +| --- | --- | --- | --- | +| working_directory | Set working directory | `false` | . | +| using_nextjs | Setup next.js cache modules | `false` | false | +| pnpm_version | Setup pnpm version | `false` | latest | +| cache | Run action cache | `false` | true | + + + + + + + +## Runs + +This action is a `composite` action. + diff --git a/packages/rancher/README.md b/packages/rancher/README.md new file mode 100644 index 00000000..dd5ee988 --- /dev/null +++ b/packages/rancher/README.md @@ -0,0 +1,27 @@ + +## Description + +configure namespace location on rancher project + + + +## Inputs + +| parameter | description | required | default | +| --- | --- | --- | --- | +| rancher_host | Rancher host | `true` | | +| rancher_access_key | Rancher access key | `true` | | +| rancher_secret_key | Rancher secret key | `true` | | +| rancher_cluster_id | Rancher cluster id | `true` | | +| working_directory | Set working directory | `false` | . | + + + + + + + +## Runs + +This action is a `composite` action. + diff --git a/packages/swagger/README.md b/packages/swagger/README.md new file mode 100644 index 00000000..4b001517 --- /dev/null +++ b/packages/swagger/README.md @@ -0,0 +1,27 @@ + +## Description + +Setup Swagger build + + + +## Inputs + +| parameter | description | required | default | +| --- | --- | --- | --- | +| swagger_script_path | shell script path and name for swagger env | `false` | | +| project_id | GCP project id | `false` | | +| gcr_host | GCP container registry host | `false` | | +| openapi_input_file | openapi input file | `false` | | +| openapi_output_file | openapi output file | `false` | | + + + + + + + +## Runs + +This action is a `composite` action. + diff --git a/packages/yarn/README.md b/packages/yarn/README.md new file mode 100644 index 00000000..cad2b840 --- /dev/null +++ b/packages/yarn/README.md @@ -0,0 +1,25 @@ + +## Description + +Setup yarn & cache modules + + + +## Inputs + +| parameter | description | required | default | +| --- | --- | --- | --- | +| working_directory | Set working directory | `false` | . | +| using_nextjs | Setup next.js cache modules | `false` | false | +| cache | Run action cache | `false` | true | + + + + + + + +## Runs + +This action is a `composite` action. + diff --git a/rollback/README.md b/rollback/README.md new file mode 100644 index 00000000..08a2edb0 --- /dev/null +++ b/rollback/README.md @@ -0,0 +1,28 @@ + +## Description + +Rollback release deployment + + + +## Inputs + +| parameter | description | required | default | +| --- | --- | --- | --- | +| credentials_json | GCP credentials services account | `true` | | +| gke_cluster_name | GKE cluster name | `true` | | +| gke_cluster_zone | GKE cluster location zone | `true` | | +| project_id | GCP project id | `true` | | +| rollback_release | rollback release | `false` | | +| rollback_revision | rollback revision | `false` | | + + + + + + + +## Runs + +This action is a `composite` action. + diff --git a/tools/frontend/lighthouse/README.md b/tools/frontend/lighthouse/README.md new file mode 100644 index 00000000..a5ae9fa9 --- /dev/null +++ b/tools/frontend/lighthouse/README.md @@ -0,0 +1,27 @@ + +## Description + +Frontend tools for audit lighthouse + + + +## Inputs + +| parameter | description | required | default | +| --- | --- | --- | --- | +| working_directory | Set working directory | `false` | . | +| urls | Set lighthouse urls | `true` | | +| budget_path | Set lighthouse budget path | `true` | | +| config_path | Set lighthouse config path | `true` | | +| gh_token | Set github token | `true` | | + + + + + + + +## Runs + +This action is a `composite` action. + diff --git a/tools/frontend/nextjs-bundle-analysis/README.md b/tools/frontend/nextjs-bundle-analysis/README.md new file mode 100644 index 00000000..53e16160 --- /dev/null +++ b/tools/frontend/nextjs-bundle-analysis/README.md @@ -0,0 +1,27 @@ + +## Description + +Frontend tools for audit nextjs bundle analysis + + + +## Inputs + +| parameter | description | required | default | +| --- | --- | --- | --- | +| working_directory | Set working directory | `false` | . | +| comment_header | Set comment header | `false` | Next.js Bundle Analysis | +| workflow_name | Set workflow name | `true` | | +| base_branch | Set base branch | `true` | | +| pr_number | Set pr number | `false` | | + + + + + + + +## Runs + +This action is a `composite` action. + diff --git a/unit_test/backend/README.md b/unit_test/backend/README.md index 6f99a28a..71027a5c 100644 --- a/unit_test/backend/README.md +++ b/unit_test/backend/README.md @@ -1,32 +1,31 @@ -# How to use this composite action -Example of usage: -``` -name: Test Coverage -on: - pull_request: - branches: - - master + +## Description -jobs: - test-coverage: - if: ${{ !github.event.pull_request.draft }} - runs-on: ktbs-infra-k8s-runner - steps: - - name: Test Coverage - uses: kitabisa/composite-actions/unit_test/backend@878932e5ea13a1db81014c8b27635d21c69f2b96 - with: - gh_user: ${{ secrets.GH_USER }} - gh_token: ${{ secrets.GH_TOKEN }} - cache: true - cache_dependency_path: go.sum - go_version: 1.19 - custom_command_flag: true - custom_command: "cp ./params/.env.sample ./params/.env" - need_mockery: true +Build and push docker image + -``` + +## Inputs -Parameters that you can configure -- custom_command_flag: by default is false, set to true if you have custom command for unit test -- custom_command: custom command that you want to run for executing unit test. For example, our unit test need to use `.env` so we have to copy `.env.sample` -- need_mockery: by default is false, set to true if you need mockery for unit test (e.g you want to re-generate mock before running UT) +| parameter | description | required | default | +| --- | --- | --- | --- | +| gh_user | gh user | `true` | | +| gh_token | gh token | `true` | | +| cache | enable cache for go modules | `false` | true | +| cache_dependency_path | go sum location | `false` | go.sum | +| go_version | go version | `false` | ^1.13.1 | +| need_mockery | need mockery | `false` | false | +| custom_command_flag | custom command flag | `false` | false | +| custom_command | custom command | `false` | echo no command | +| unit_test_command | unit test command | `false` | go test ./internal/... -coverpkg=./... -coverprofile=coverage.out -covermode=atomic | + + + + + + + +## Runs + +This action is a `composite` action. +