Inicia Implementacao de Refresh
This commit is contained in:
30
.github/workflows/deploy-cluster.yml
vendored
Normal file
30
.github/workflows/deploy-cluster.yml
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
name: remote ssh command
|
||||
|
||||
on:
|
||||
repository_dispatch:
|
||||
types: [deploy-prod]
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- staging
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Deploy to Cluster
|
||||
environment: ${{ github.ref_name == 'main' && 'prod' || 'staging' }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Writing Env File
|
||||
run: |
|
||||
echo "${{ secrets.ENV_FILE }}" | base64 -d > .env
|
||||
- name: Set Kubernetes Context
|
||||
uses: azure/k8s-set-context@v1
|
||||
with:
|
||||
method: kubeconfig
|
||||
kubeconfig: ${{ secrets.KUBE_CONFIG }}
|
||||
- name: Execute deploy
|
||||
run: |
|
||||
./deploy.sh -f .env
|
||||
58
.github/workflows/deploy-prod.yml
vendored
58
.github/workflows/deploy-prod.yml
vendored
@@ -1,58 +0,0 @@
|
||||
name: remote ssh command
|
||||
|
||||
on:
|
||||
repository_dispatch:
|
||||
types: [deploy-prod]
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
environment: prod
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python 3.8
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: "3.10"
|
||||
|
||||
- name: Create Config Json File
|
||||
run: |
|
||||
echo "${{ secrets.CONFIG_JSON }}" | base64 -d > config.json
|
||||
|
||||
- name: Inserts Prod Enviromental Variables
|
||||
run: |
|
||||
python -m pip install --upgrade pip pipenv
|
||||
pipenv install
|
||||
pipenv run python setup.py -e prod -f config.json
|
||||
|
||||
- name: copy file via ssh
|
||||
uses: appleboy/scp-action@master
|
||||
with:
|
||||
host: ${{ secrets.SSH_HOST }}
|
||||
username: ${{ secrets.SSH_USER }}
|
||||
port: ${{ secrets.SSH_PORT }}
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
source: "."
|
||||
target: "infra-hideyoshi.com"
|
||||
|
||||
- name: executing remote ssh commands
|
||||
uses: appleboy/ssh-action@master
|
||||
with:
|
||||
host: ${{ secrets.SSH_HOST }}
|
||||
username: ${{ secrets.SSH_USER }}
|
||||
port: ${{ secrets.SSH_PORT }}
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
command_timeout: 30m
|
||||
script: |
|
||||
sudo apt update && sudo apt install -y jq
|
||||
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
|
||||
source ~/.profile
|
||||
cd infra-hideyoshi.com
|
||||
./deploy.sh --prod
|
||||
./refresh.sh
|
||||
56
.github/workflows/deploy-staging.yml
vendored
56
.github/workflows/deploy-staging.yml
vendored
@@ -1,56 +0,0 @@
|
||||
name: remote ssh command
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- staging
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
environment: staging
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python 3.8
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: "3.10"
|
||||
|
||||
- name: Create Config Json File
|
||||
run: |
|
||||
echo "${{ secrets.CONFIG_JSON }}" | base64 -d > config.json
|
||||
|
||||
- name: Inserts Prod Enviromental Variables
|
||||
run: |
|
||||
python -m pip install --upgrade pip pipenv
|
||||
pipenv install
|
||||
pipenv run python setup.py -e staging -f config.json
|
||||
|
||||
- name: copy file via ssh
|
||||
uses: appleboy/scp-action@master
|
||||
with:
|
||||
host: ${{ secrets.SSH_HOST }}
|
||||
username: ${{ secrets.SSH_USER }}
|
||||
port: ${{ secrets.SSH_PORT }}
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
source: "."
|
||||
target: "infra-hideyoshi.com"
|
||||
|
||||
- name: executing remote ssh commands
|
||||
uses: appleboy/ssh-action@master
|
||||
with:
|
||||
host: ${{ secrets.SSH_HOST }}
|
||||
username: ${{ secrets.SSH_USER }}
|
||||
port: ${{ secrets.SSH_PORT }}
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
command_timeout: 30m
|
||||
script: |
|
||||
sudo apt update && sudo apt install -y jq
|
||||
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
|
||||
source ~/.profile
|
||||
cd infra-hideyoshi.com
|
||||
./deploy.sh --staging
|
||||
./refresh.sh
|
||||
18
deploy.sh
18
deploy.sh
@@ -149,8 +149,13 @@ main() {
|
||||
}
|
||||
|
||||
|
||||
refresh() {
|
||||
}
|
||||
|
||||
|
||||
environment="remote"
|
||||
setup_minikube="false"
|
||||
execution_mode="deploy"
|
||||
|
||||
while getopts ":f:e:mh" opt; do
|
||||
case ${opt} in
|
||||
@@ -170,6 +175,10 @@ while getopts ":f:e:mh" opt; do
|
||||
echo "Usage: deploy.sh [-f <env_file>] [-e <environment>] [-m <minikube>]"
|
||||
exit 0
|
||||
;;
|
||||
r )
|
||||
echo "Executing Refresh"
|
||||
execution_mode="refresh"
|
||||
;;
|
||||
*)
|
||||
echo "Invalid option: $OPTARG"
|
||||
exit 1
|
||||
@@ -177,4 +186,11 @@ while getopts ":f:e:mh" opt; do
|
||||
esac
|
||||
done
|
||||
|
||||
main
|
||||
if [[ $execution_mode == "deploy" ]]; then
|
||||
main
|
||||
elif [[ $execution_mode == "refresh" ]]; then
|
||||
refresh
|
||||
else
|
||||
echo "Invalid execution mode: $execution_mode"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user