diff --git a/.github/workflows/pr-deploy.yml b/.github/workflows/pr-deploy.yml new file mode 100644 index 00000000..0f8e2419 --- /dev/null +++ b/.github/workflows/pr-deploy.yml @@ -0,0 +1,36 @@ +name: PR Deploy + +on: + pull_request: + types: [opened, synchronize, reopened, closed] + +jobs: + deploy-pr: + environment: + name: preview + url: ${{ steps.deploy.outputs.preview-url }} + runs-on: ubuntu-latest + + steps: + - name: Checkout to branch + uses: actions/checkout@v4 + + - id: deploy + name: Pull Request Deploy + uses: hngprojects/pr-deploy + with: + server_host: ${{ secrets.SERVER_HOST }} + server_username: ${{ secrets.SERVER_USERNAME }} + server_password: ${{ secrets.SERVER_PASSWORD }} + server_port: ${{ secrets.SERVER_PORT }} + comment: true + context: '.' + dockerfile: 'Dockerfile' + exposed_port: '8000' + host_volume_path: '/var/' + container_volume_path: '/var/' + github_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Print Preview URL + run: | + echo "Preview URL: ${{ steps.deploy.outputs.preview-url }}"