Skip to content
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

build: Clean up actions #797

Merged
merged 1 commit into from
Jan 16, 2024
Merged
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
142 changes: 0 additions & 142 deletions .github/workflows/activity_ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ on:
paths-ignore:
- 'docs/**'
- '*.md'
release:
types:
- published

jobs:
Build_lint_test:
Expand Down Expand Up @@ -41,142 +38,3 @@ jobs:
coverage report
echo "----------- Upload test coverage ---------"
bash <(curl -s https://codecov.io/bash)

Infrastructure:
runs-on: ubuntu-latest
needs: Build_lint_test
if: github.ref == 'refs/heads/develop' || github.event_name == 'release'
steps:
- uses: actions/checkout@v1
- name: Setup terraform
run: |
export VER="0.12.21"
wget https://releases.hashicorp.com/terraform/${VER}/terraform_${VER}_linux_amd64.zip
unzip terraform_${VER}_linux_amd64.zip
sudo mv terraform /usr/local/bin/
terraform version

- name: Run infrastructure script
env:
BACKEND_BUCKET_DEV_ENV: ${{ secrets.BACKEND_BUCKET_DEV_ENV }}
STATE_FILE_DEV_ENV: ${{ secrets.STATE_FILE_DEV_ENV }}
SPACES_ACCESS_KEY: ${{ secrets.SPACES_ACCESS_KEY }}
SPACES_SECRET_KEY: ${{ secrets.SPACES_SECRET_KEY }}
CLUSTER_NAME_DEV_ENV: ${{ secrets.CLUSTER_NAME_DEV_ENV }}
CLUSTER_REGION: ${{ secrets.CLUSTER_REGION }}
K8S_VERSION: ${{ secrets.K8S_VERSION }}
NODE_TYPE: ${{ secrets.NODE_TYPE }}
MAX_NODE_NUM: ${{ secrets.MAX_NODE_NUM }}
MIN_NODE_NUM: ${{ secrets.MIN_NODE_NUM }}
SERVICE_ACCESS_TOKEN: ${{ secrets.SERVICE_ACCESS_TOKEN }}
DB_SIZE: ${{ secrets.DB_SIZE }}
PG_VERSION: ${{ secrets.PG_VERSION }}
PROJECT_NAME: $$ {{ secrets.PROJECT_NAME }}
DB_NAME_DEV_ENV: ${{ secrets.DB_NAME_DEV_ENV }}
# Prod vars
BACKEND_BUCKET_PROD: ${{ secrets.BACKEND_BUCKET_PROD }}
STATE_FILE_PROD: ${{ secrets.STATE_FILE_PROD }}
CLUSTER_NAME_PROD: ${{ secrets.CLUSTER_NAME_PROD }}
K8S_VERSION_PROD: ${{ secrets.K8S_VERSION_PROD }}
DB_NAME_PROD: ${{ secrets.DB_NAME_PROD }}
run: |
chmod +x ci-scripts/create_infrastructure.sh
bash ./ci-scripts/create_infrastructure.sh

Build_and_push_image:
runs-on: ubuntu-latest
needs: Infrastructure
if: github.ref == 'refs/heads/develop' || github.event_name == 'release'
steps:
- uses: actions/checkout@v1
- name: Setup docker-ce
run: |
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt install docker-ce
sudo docker version

- name: Build and Push
env:
TAG_NAME: ${{ github.event.release.tag_name }}
DOCKER_HUB_USERNM: ${{ secrets.DOCKER_HUB_USERNM }}
DOCKER_HUB_PASSWD: ${{ secrets.DOCKER_HUB_PASSWD }}
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
ACTIVITY_CE_DB_NAME_DEV: ${{ secrets.ACTIVITY_CE_DB_NAME_DEV }}
ACTIVITY_CE_DB_USER_DEV: ${{ secrets.ACTIVITY_CE_DB_USER_DEV }}
ACTIVITY_CE_DB_PASSWORD_DEV: ${{ secrets.ACTIVITY_CE_DB_PASSWORD_DEV }}
ACTIVITY_CE_DB_HOST_DEV: ${{ secrets.ACTIVITY_CE_DB_HOST_DEV }}
SECRET_KEY: ${{ secrets.SECRET_KEY }}
DEBUG: ${{ secrets.DEBUG }}
DJANGO_ALLOWED_HOSTS: ${{ secrets.DJANGO_ALLOWED_HOSTS }}
DB_ENGINE: ${{ secrets.DB_ENGINE }}
ACTIVITY_CE_DB_PORT_DEV: ${{ secrets.ACTIVITY_CE_DB_PORT_DEV }}
APPLICATION_ENV: ${{ secrets.APPLICATION_ENV }}
EMAIL_PORT: ${{ secrets.EMAIL_PORT }}
EMAIL_HOST_USER: ${{ secrets.EMAIL_HOST_USER }}
EMAIL_HOST_PASSWORD: ${{ secrets.EMAIL_HOST_PASSWORD }}
EMAIL_HOST: ${{ secrets.EMAIL_HOST }}
GOOGLE_MAP_API_KEY: ${{ secrets.GOOGLE_MAP_API_KEY }}
APPLICATION_NAME: ${{ secrets.APPLICATION_NAME }}
REGISTRY_OWNER: ${{ secrets.REGISTRY_OWNER }}
APPLICATION_NAME_DEV: ${{ secrets.APPLICATION_NAME_DEV }}
# Production Vars
APPLICATION_ENV_PROD: ${{ secrets.APPLICATION_ENV_PROD }}
ACTIVITY_CE_DB_NAME_PROD: ${{ secrets.ACTIVITY_CE_DB_NAME_PROD }}
ACTIVITY_CE_DB_USER_PROD: ${{ secrets.ACTIVITY_CE_DB_USER_PROD }}
ACTIVITY_CE_DB_PASSWORD_PROD: ${{ secrets.ACTIVITY_CE_DB_PASSWORD_PROD }}
ACTIVITY_CE_DB_HOST_PROD: ${{ secrets.ACTIVITY_CE_DB_HOST_PROD }}
ACTIVITY_CE_DB_PORT_PROD: ${{ secrets.ACTIVITY_CE_DB_PORT_PROD }}
run: |
chmod +x ci-scripts/build_docker_image.sh
bash ./ci-scripts/build_docker_image.sh

Deploy:
needs: Build_and_push_image
runs-on: ubuntu-latest
if: github.event_name == 'release'
container:
image: yagami22/ci-deploy-image
steps:
- uses: actions/checkout@v1
- name: Deploy to DO
env:
APPLICATION_ENV: ${{ secrets.APPLICATION_ENV }}
CLUSTER_NAME_DEV_ENV: ${{ secrets.CLUSTER_NAME_DEV_ENV }}
SERVICE_ACCESS_TOKEN: ${{ secrets.SERVICE_ACCESS_TOKEN }}
DOCKER_HUB_USERNM: ${{ secrets.DOCKER_HUB_USERNM }}
DOCKER_HUB_PASSWD: ${{ secrets.DOCKER_HUB_PASSWD }}
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
B64_TOKEN: ${{ secrets.B64_TOKEN }}
DEFAULT_NOTIFY: ${{ secrets.DEFAULT_NOTIFY }}
RATE_LIMIT: ${{ secrets.RATE_LIMIT }}
APPLICATION_NAME: ${{ secrets.APPLICATION_NAME }}
REGISTRY_OWNER: ${{ secrets.REGISTRY_OWNER }}
MIN_PODS: ${{ secrets.MIN_PODS }}
MAX_PODS: ${{ secrets.MAX_PODS }}
APPLICATION_NAME_DEV: ${{ secrets.APPLICATION_NAME_DEV }}
MIN_PODS_DEV: ${{ secrets.MIN_PODS_DEV }}
HOST_DOMAIN_DEV: ${{ secrets.HOST_DOMAIN_DEV }}
SLACK_CHANNEL_HOOK: ${{ secrets.SLACK_CHANNEL_HOOK }}
# Production Vars
APPLICATION_ENV_PROD: ${{ secrets.APPLICATION_ENV_PROD }}
CLUSTER_NAME_PROD: ${{ secrets.CLUSTER_NAME_PROD }}
HOST_DOMAIN_PROD: ${{ secrets.HOST_DOMAIN_PROD }}
MIN_PODS_PROD: ${{ secrets.MIN_PODS_PROD }}
APPLICATION_NAME_PROD: ${{ secrets.APPLICATION_NAME_PROD }}
run: |
export FILE_PATH="/github/home/.docker/config.json"
chmod +x ci-scripts/deployment.sh
bash ./ci-scripts/deployment.sh
if [[ $? -eq 0 ]]; then
export DEPLOY="success"
else
export DEPLOY="fail"
fi
export EMOJI=":github:"
export TRAVIS_COMMIT_MESSAGE="No Commit message"
chmod +x ci-scripts/notify_slack.sh
bash ./ci-scripts/notify_slack.sh
Loading