Skip to content

Commit

Permalink
Update deploy.yml to trigger deployment pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
ShootGan committed Mar 17, 2024
1 parent 8f77186 commit 0564a7b
Showing 1 changed file with 14 additions and 37 deletions.
51 changes: 14 additions & 37 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,43 +32,20 @@ jobs:
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ghcr.io/wkk-offcial/lavalink_helper_api:latest
tags: ghcr.io/wkk-offcial/lavalink_helper_api:latest,ghcr.io/wkk-offcial/lavalink_helper_api:{{ github.sha }}

deploy:
name: Deploy to EC2
needs: docker_build
trigger_deploy:
name: Trigger deployment pipeline
runs-on: ubuntu-latest
needs: docker_build
steps:
- name: Deploy Image on EC2
uses: appleboy/[email protected]
env:
DOCKER_IMAGE: "ghcr.io/wkk-offcial/lavalink_helper_api:latest"
DOCKER_CONTAINER_NAME: "lavalink_helper_api"
DROPBOX_APP_KEY: ${{secrets.DROPBOX_APP_KEY}}
DROPBOX_APP_SECRET: ${{secrets.DROPBOX_APP_SECRET}}
DROPBOX_REFRESH_TOKEN: ${{secrets.DROPBOX_REFRESH_TOKEN}}
with:
host: ${{secrets.BOI_HOSTNAME}}
username: opc
key: ${{secrets.BOI_PRIVATE_KEY}}
envs: DOCKER_IMAGE, DOCKER_CONTAINER_NAME, DROPBOX_APP_KEY, DROPBOX_APP_SECRET, DROPBOX_REFRESH_TOKEN
script_stop: true
script: |
if [[ -z "$(docker network ls | grep wkk-network)" ]]; then
docker network create wkk-network
fi
if [[ -z "$(docker volume ls | grep sounds)" ]]; then
docker volume create sounds
fi
docker pull $DOCKER_IMAGE
docker stop $DOCKER_CONTAINER_NAME && docker rm -fv $DOCKER_CONTAINER_NAME || true
docker run -d \
-p 36970:8000 \
-v sounds:/home/sounds \
-e DROPBOX_APP_KEY=$DROPBOX_APP_KEY \
-e DROPBOX_APP_SECRET=$DROPBOX_APP_SECRET \
-e DROPBOX_REFRESH_TOKEN=$DROPBOX_REFRESH_TOKEN \
--restart unless-stopped \
--network="wkk-network" \
--name $DOCKER_CONTAINER_NAME $DOCKER_IMAGE
docker image prune <<< y
- name: Trigger deployment pipeline
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.DEPLOY_API_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/WKK-Offcial/bot_deployment/actions/workflows/deploy.yml/dispatches \
-d '{"ref":"master"}'

0 comments on commit 0564a7b

Please sign in to comment.