Skip to content

Commit

Permalink
chore: use same workflow for all branches environments
Browse files Browse the repository at this point in the history
  • Loading branch information
jycssu-com committed Jun 11, 2024
1 parent 6d0d9cb commit 5af1047
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/preprod.yml → .github/workflows/branch.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test and deploy to pre-production
name: Test and deploy to branch

on:
push:
Expand All @@ -8,7 +8,7 @@ on:

jobs:
validate:
name: Validate pre-production
name: Validate branch
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -29,7 +29,7 @@ jobs:
run: npm run build

deploy:
name: Deploy to pre-production
name: Deploy to branch
runs-on: ubuntu-latest
needs: validate
steps:
Expand Down Expand Up @@ -68,14 +68,14 @@ jobs:
SSH_HOST: ${{ secrets.SSH_HOST }}
SSH_PORT: ${{ secrets.SSH_PORT }}

- name: Update pre-production environment
- name: Update branch environment
run: |
ssh staging 'export DOCKER_BRANCH=${{ github.ref_name }}
cd /home/realt/docker/dashboard-v2/${DOCKER_BRANCH}
git pull origin develop
docker compose --file docker-compose-${DOCKER_BRANCH}.yml pull
docker compose --file docker-compose-branch.yml pull
docker login -u ${{ secrets.DOCKER_LOGIN }} -p ${{ secrets.DOCKER_PASSWD }} ${{ secrets.DOCKER_REGISTRY }}
NEXT_PUBLIC_THEGRAPH_API_KEY=${{ secrets.NEXT_PUBLIC_THEGRAPH_API_KEY }} COMMUNITY_API_KEY=${{ secrets.COMMUNITY_API_KEY }} docker compose --project-name ${{ github.ref_name }}-dashboard --file docker-compose-${DOCKER_BRANCH}.yml up -d'
NEXT_PUBLIC_THEGRAPH_API_KEY=${{ secrets.NEXT_PUBLIC_THEGRAPH_API_KEY }} COMMUNITY_API_KEY=${{ secrets.COMMUNITY_API_KEY }} docker compose --project-name ${{ github.ref_name }}-dashboard --file docker-compose-branch.yml up -d'
env:
NEXT_PUBLIC_THEGRAPH_API_KEY: ${{ secrets.NEXT_PUBLIC_THEGRAPH_API_KEY }}
COMMUNITY_API_KEY: ${{ secrets.COMMUNITY_API_KEY }}
3 changes: 1 addition & 2 deletions docker-compose-preprod.yml → docker-compose-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ services:
- .env
environment:
- NEXT_PUBLIC_THEGRAPH_API_KEY=$NEXT_PUBLIC_THEGRAPH_API_KEY
ports:
- '3012:3000'
networks:
- traefik-realt
labels:
- 'traefik.enable=true'
- 'traefik.http.routers.dashboard-${DOCKER_BRANCH}.rule=Host(`dashboard.${DOCKER_BRANCH}.realt.community`)'
- 'traefik.http.routers.dashboard-${DOCKER_BRANCH}.entrypoints=websecure'
- 'traefik.http.services.dashboard-${DOCKER_BRANCH}.loadbalancer.server.port=3000'
restart: always

networks:
Expand Down

0 comments on commit 5af1047

Please sign in to comment.