diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..a65959c --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,41 @@ +name: "Deploy to VPS" + +on: + push: + branches: + - main + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + steps: + - name: Check out the repository + uses: actions/checkout@v4 + + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: DockerHub login + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push to DockerHub + run: | + docker build -t devarifhossain/retroui:1.02 ./ + docker push devarifhossain/retroui-web:1.02 + + - name: Set up SSH + uses: webfactory/ssh-agent@v0.9.0 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + + - name: Add VPS to known_hosts + run: | + ssh-keyscan -H ${{ secrets.VPS_HOST }} >> ~/.ssh/known_hosts + + - name: Deploy to VPS + run: | + ssh ${{ secrets.VPS_USERNAME }}@${{ secrets.VPS_HOST }} "cd /root/retroui && git pull && docker compose -f ./infra/docker-compose.prod.yml up -d" \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 48deffe..f38759d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,5 +6,8 @@ "tailwindCSS.experimental.classRegex": [ ["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"], ["cx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"] - ] + ], + "yaml.schemas": { + "https://json.schemastore.org/github-workflow.json": "file:///Users/arifhossain/Projects/ptm/retro-ui/.github/workflows/deploy.yml" + } } diff --git a/infra/Caddyfile b/infra/Caddyfile index ea446ee..4444cb3 100644 --- a/infra/Caddyfile +++ b/infra/Caddyfile @@ -1,3 +1,3 @@ -retroui.dev { +new.retroui.dev { reverse_proxy retroui:3000 } \ No newline at end of file