Skip to content

Commit

Permalink
fix(deploy): fix env vars (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
dice4x4 authored Jun 23, 2022
1 parent 8d779af commit 39a65b2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 22 deletions.
25 changes: 14 additions & 11 deletions .github/workflows/deploy-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,6 @@ jobs:
deploy:
name: Build and Deploy release
runs-on: ubuntu-latest
env:
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_DB: ${{ secrets.POSTGRES_DB }}
DB_PORT: ${{ secrets.DB_PORT }}
DB_HOST: ${{ secrets.DB_HOST }}
DB_DIALECT: postgres
SERVER_PORT: 8000
ACCESS_TOKEN_LIFETIME: 300000
REFRESH_TOKEN_LIFETIME: 3600000
steps:
- name: Checkout latest
uses: actions/checkout@v3
Expand Down Expand Up @@ -66,6 +56,16 @@ jobs:

- name: executing remote ssh commands using ssh key
uses: appleboy/ssh-action@master
env:
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_DB: ${{ secrets.POSTGRES_DB }}
DB_PORT: ${{ secrets.DB_PORT }}
DB_HOST: ${{ secrets.DB_HOST }}
DB_DIALECT: postgres
SERVER_PORT: 8000
ACCESS_TOKEN_LIFETIME: 300000
REFRESH_TOKEN_LIFETIME: 3600000
with:
host: ${{ env.HOST }}
username: ${{ env.USERNAME }}
Expand All @@ -75,6 +75,9 @@ jobs:
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u dice4x4 --password-stdin
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
docker rm -f ${{ env.NAME }}
docker run -dp 8084:8000 --network wndrnet --name ${{ env.NAME }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
docker run -dp 8084:8000 --network wndrnet --name ${{ env.NAME }} \
-e POSTGRES_USER -e POSTGRES_PASSWORD -e POSTGRES_DB -e DB_PORT -e DB_HOST -e DB_DIALECT -e SERVER_PORT \
-e ACCESS_TOKEN_LIFETIME -e REFRESH_TOKEN_LIFETIME \
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
docker logout
25 changes: 14 additions & 11 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ jobs:
deploy:
name: Deploy staging
runs-on: ubuntu-latest
env:
POSTGRES_USER: ${{ secrets.POSTGRES_USER_STAGE }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD_STAGE }}
POSTGRES_DB: ${{ secrets.POSTGRES_DB_STAGE }}
DB_PORT: ${{ secrets.DB_PORT_STAGE }}
DB_HOST: ${{ secrets.DB_HOST_STAGE }}
DB_DIALECT: postgres
SERVER_PORT: 8000
ACCESS_TOKEN_LIFETIME: 300000
REFRESH_TOKEN_LIFETIME: 3600000
steps:
- name: executing remote ssh commands using ssh key
uses: appleboy/ssh-action@master
env:
POSTGRES_USER: ${{ secrets.POSTGRES_USER_STAGE }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD_STAGE }}
POSTGRES_DB: ${{ secrets.POSTGRES_DB_STAGE }}
DB_PORT: ${{ secrets.DB_PORT_STAGE }}
DB_HOST: ${{ secrets.DB_HOST_STAGE }}
DB_DIALECT: postgres
SERVER_PORT: 8000
ACCESS_TOKEN_LIFETIME: 300000
REFRESH_TOKEN_LIFETIME: 3600000
with:
host: ${{ env.HOST }}
username: ${{ env.USERNAME }}
Expand All @@ -42,6 +42,9 @@ jobs:
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u dice4x4 --password-stdin
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:pr-${{ github.event.pull_request.number }}
docker rm -f ${{ env.NAME }}
docker run -dp 8083:8000 --network wndrnet --name ${{ env.NAME }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:pr-${{ github.event.pull_request.number }}
docker run -dp 8083:8000 --network wndrnet --name ${{ env.NAME }} \
-e POSTGRES_USER -e POSTGRES_PASSWORD -e POSTGRES_DB -e DB_PORT -e DB_HOST -e DB_DIALECT -e SERVER_PORT \
-e ACCESS_TOKEN_LIFETIME -e REFRESH_TOKEN_LIFETIME \
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:pr-${{ github.event.pull_request.number }}
docker logout

0 comments on commit 39a65b2

Please sign in to comment.