Skip to content

Commit 6f26daa

Browse files
🚀 Webapp QA deployment using composite actions (#1)
* first commit * fix inputs * make shell exectuable * remove js * make shell exec * fix missing parameter * fix missing parameter * add branch name * fix typo * add debug statement * fix typo * remove debug statements * add codewonders and update readme * change name and version * fix name of shell script * add to in the name * fix name * add envs * move comments in code * fix comment * Fix domain name
1 parent d2f5244 commit 6f26daa

File tree

6 files changed

+92
-2
lines changed

6 files changed

+92
-2
lines changed

.gitignore

Whitespace-only changes.

CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @rahulpatidar0191

DeployToQA.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
export CLEAN_BRANCH_NAME=$CLEAN_BRANCH_NAME # set this env variable for docker compose
4+
5+
echo "Deploy to ${APP_NAME}-qa.satel.ca"
6+
export DOCKER_TLS_VERIFY='1'
7+
export DOCKER_HOST='tcp://34.234.172.171:2376'
8+
export DOCKER_CERT_PATH='/home/satel/.docker/machine/machines/satel-webapps-qa'
9+
docker login --username=$DOCKER_USER --password=$DOCKER_PASS $REGISTRY
10+
docker stack deploy --with-registry-auth -c docker-compose.qa.yml ${APP_NAME}

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Satel
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+29-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,29 @@
1-
# satel-qa-deployment
2-
Centralized GitHub actions to deploy a webapp to QA environment
1+
# Satel QA Deployment
2+
This centralized GitHub action deploys a webapp to QA environment/VM
3+
4+
## Usage
5+
```yml
6+
name: "QA deployment"
7+
on:
8+
push:
9+
branches:
10+
- main
11+
deploy-to-qa:
12+
name: Deploy webapp to QA vm
13+
needs: [generate-variables, build-client, build-server]
14+
if: github.ref == 'refs/heads/main' # run only on main
15+
# host_name is self-hosted or the name of server where the action runner is hosted, self-hosted for example
16+
runs-on: <host-name>
17+
steps:
18+
- name: Deploy to QA vm
19+
uses: SatelCreative/satel-qa-deployment@v1
20+
with:
21+
app-name: <app-name>
22+
# clean-branch-name parameter is set in a previous step
23+
clean-branch-name: ${{ needs.registry-push.outputs.clean-branch-name }}
24+
# satel-docker-user & satel-docker-pass are secrets added from the settings
25+
satel-docker-user: ${{ secrets.SATEL_DOCKER_USER }}
26+
satel-docker-pass: ${{ secrets.SATEL_DOCKER_PASS }}
27+
satel-registry: docker.satel.ca
28+
```
29+

action.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Satel-webapp-QA-deployment
2+
description: Deploys webapp to QA VM/environment
3+
inputs:
4+
app-name:
5+
description: Name of the webapp
6+
required: true
7+
satel-docker-user:
8+
description: Username for satel docker registry
9+
required: true
10+
satel-docker-pass:
11+
description: Password for satel docker registry
12+
required: true
13+
satel-registry:
14+
description: Satel registry address
15+
required: true
16+
clean-branch-name:
17+
description: Clean branch name
18+
required: true
19+
20+
runs:
21+
using: "composite"
22+
steps:
23+
- name: Deploy to QA VM
24+
env:
25+
APP_NAME: ${{ inputs.app-name }}
26+
DOCKER_USER: ${{ inputs.satel-docker-user }}
27+
DOCKER_PASS: ${{ inputs.satel-docker-pass }}
28+
REGISTRY: ${{ inputs.satel-registry }}
29+
CLEAN_BRANCH_NAME: ${{ inputs.clean-branch-name }}
30+
run: ${{ github.action_path }}/DeployToQA.sh
31+
shell: bash

0 commit comments

Comments
 (0)