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

389 split instances #399

Merged
merged 15 commits into from
Oct 25, 2022
11 changes: 7 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,14 @@ jobs:
run: |
echo "DEPLOYMENT_TARGET=production" >> $GITHUB_ENV
echo "RELEASE_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
echo "DEPLOYMENT_HOST=${{secrets.DEPLOY_HOST}}" >> $GITHUB_ENV

# set target deployment to staging on push
- name: Configuration for pushes
if: ${{ github.event_name == 'push' }}
run: echo "DEPLOYMENT_TARGET=staging" >> $GITHUB_ENV
run: |
echo "DEPLOYMENT_TARGET=staging" >> $GITHUB_ENV
echo "DEPLOYMENT_HOST=${{secrets.STAGING_DEPLOY_HOST}}" >> $GITHUB_ENV

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
Expand All @@ -83,13 +86,13 @@ jobs:
- name: Pull image and start container in deploy host
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.DEPLOY_HOST }}
host: ${{ env.DEPLOYMENT_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_SSH_KEY }}
script: |
cd /codey/${{env.DEPLOYMENT_TARGET}}
curl -o docker-compose.yml https://raw.githubusercontent.com/uwcsc/codeybot/main/docker/${{env.DEPLOYMENT_TARGET}}/docker-compose.yml
docker pull uwcsclub/codey-bot:${{ github.event_name == 'push' && github.sha || env.RELEASE_TAG }}
echo "TAG=${{ github.event_name == 'push' && github.sha || env.RELEASE_TAG }}" > docker.env
docker-compose down
docker-compose --env-file docker.env up -d
docker compose --env-file docker.env down
docker compose --env-file docker.env up -d