Skip to content

🚀 Webapp QA deployment using composite actions #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .gitignore
Empty file.
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @rahulpatidar0191
10 changes: 10 additions & 0 deletions DeployToQA.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

export CLEAN_BRANCH_NAME=$CLEAN_BRANCH_NAME # set this env variable for docker compose

echo "Deploy to ${APP_NAME}-qa.satel.ca"
export DOCKER_TLS_VERIFY='1'
export DOCKER_HOST='tcp://34.234.172.171:2376'
export DOCKER_CERT_PATH='/home/satel/.docker/machine/machines/satel-webapps-qa'
docker login --username=$DOCKER_USER --password=$DOCKER_PASS $REGISTRY
docker stack deploy --with-registry-auth -c docker-compose.qa.yml ${APP_NAME}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Satel

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
31 changes: 29 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,29 @@
# satel-qa-deployment
Centralized GitHub actions to deploy a webapp to QA environment
# Satel QA Deployment
This centralized GitHub action deploys a webapp to QA environment/VM

## Usage
```yml
name: "QA deployment"
on:
push:
branches:
- main
deploy-to-qa:
name: Deploy webapp to QA vm
needs: [generate-variables, build-client, build-server]
if: github.ref == 'refs/heads/main' # run only on main
# host_name is self-hosted or the name of server where the action runner is hosted, self-hosted for example
runs-on: <host-name>
steps:
- name: Deploy to QA vm
uses: SatelCreative/satel-qa-deployment@v1
with:
app-name: <app-name>
# clean-branch-name parameter is set in a previous step
clean-branch-name: ${{ needs.registry-push.outputs.clean-branch-name }}
# satel-docker-user & satel-docker-pass are secrets added from the settings
satel-docker-user: ${{ secrets.SATEL_DOCKER_USER }}
satel-docker-pass: ${{ secrets.SATEL_DOCKER_PASS }}
satel-registry: docker.satel.ca
```

31 changes: 31 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Satel-webapp-QA-deployment
description: Deploys webapp to QA VM/environment
inputs:
app-name:
description: Name of the webapp
required: true
satel-docker-user:
description: Username for satel docker registry
required: true
satel-docker-pass:
description: Password for satel docker registry
required: true
satel-registry:
description: Satel registry address
required: true
clean-branch-name:
description: Clean branch name
required: true

runs:
using: "composite"
steps:
- name: Deploy to QA VM
env:
APP_NAME: ${{ inputs.app-name }}
DOCKER_USER: ${{ inputs.satel-docker-user }}
DOCKER_PASS: ${{ inputs.satel-docker-pass }}
REGISTRY: ${{ inputs.satel-registry }}
CLEAN_BRANCH_NAME: ${{ inputs.clean-branch-name }}
run: ${{ github.action_path }}/DeployToQA.sh
shell: bash