From eb4fd90764df8e58da08e06e247bcfb42a44105f Mon Sep 17 00:00:00 2001 From: ekedonald Date: Thu, 8 Aug 2024 20:21:34 +0100 Subject: [PATCH] Upload pr_deploy workflow files for production, staging and development. --- .github/workflows/development_pr_deploy.yml | 39 +++++++++++++++++++++ .github/workflows/production_pr_deploy.yml | 39 +++++++++++++++++++++ .github/workflows/staging_pr_deploy.yml | 39 +++++++++++++++++++++ 3 files changed, 117 insertions(+) create mode 100644 .github/workflows/development_pr_deploy.yml create mode 100644 .github/workflows/production_pr_deploy.yml create mode 100644 .github/workflows/staging_pr_deploy.yml diff --git a/.github/workflows/development_pr_deploy.yml b/.github/workflows/development_pr_deploy.yml new file mode 100644 index 0000000..7b91cf9 --- /dev/null +++ b/.github/workflows/development_pr_deploy.yml @@ -0,0 +1,39 @@ +name: PR Deploy +on: + pull_request: + types: [opened, synchronize, reopened, closed] + workflow_dispatch: + +jobs: + deploy-pr: + environment: + name: development + # url: ${{ steps.deploy.outputs.preview-url }} + runs-on: ubuntu-latest + env: + SSH_USERNAME: ${{ secrets.SSH_USERNAME }} + SSH_HOST: ${{ secrets.SSH_HOST }} + SSH_PORT: ${{ secrets.SSH_PORT }} + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + + steps: + - name: Checkout to branch + uses: actions/checkout@v4 + - id: deploy + name: Pull Request Deploy + uses: hngprojects/pr-deploy@dev + with: + server_host: ${{ env.SSH_HOST }} + server_username: ${{ env.SSH_USERNAME }} + server_password: ${{ secrets.SERVER_PASSWORD }} + server_port: ${{ env.SSH_PORT }} + comment: true + context: '.' + dockerfile: 'Dockerfile' + exposed_port: '8019' + # 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 }}" \ No newline at end of file diff --git a/.github/workflows/production_pr_deploy.yml b/.github/workflows/production_pr_deploy.yml new file mode 100644 index 0000000..7d0ca78 --- /dev/null +++ b/.github/workflows/production_pr_deploy.yml @@ -0,0 +1,39 @@ +name: PR Deploy +on: + pull_request: + types: [opened, synchronize, reopened, closed] + workflow_dispatch: + +jobs: + deploy-pr: + environment: + name: production + # url: ${{ steps.deploy.outputs.preview-url }} + runs-on: ubuntu-latest + env: + SSH_USERNAME: ${{ secrets.SSH_USERNAME }} + SSH_HOST: ${{ secrets.SSH_HOST }} + SSH_PORT: ${{ secrets.SSH_PORT }} + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + + steps: + - name: Checkout to branch + uses: actions/checkout@v4 + - id: deploy + name: Pull Request Deploy + uses: hngprojects/pr-deploy@main + with: + server_host: ${{ env.SSH_HOST }} + server_username: ${{ env.SSH_USERNAME }} + server_password: ${{ secrets.SERVER_PASSWORD }} + server_port: ${{ env.SSH_PORT }} + comment: true + context: '.' + dockerfile: 'Dockerfile' + exposed_port: '8019' + # 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 }}" \ No newline at end of file diff --git a/.github/workflows/staging_pr_deploy.yml b/.github/workflows/staging_pr_deploy.yml new file mode 100644 index 0000000..f9a5877 --- /dev/null +++ b/.github/workflows/staging_pr_deploy.yml @@ -0,0 +1,39 @@ +name: PR Deploy +on: + pull_request: + types: [opened, synchronize, reopened, closed] + workflow_dispatch: + +jobs: + deploy-pr: + environment: + name: staging + # url: ${{ steps.deploy.outputs.preview-url }} + runs-on: ubuntu-latest + env: + SSH_USERNAME: ${{ secrets.SSH_USERNAME }} + SSH_HOST: ${{ secrets.SSH_HOST }} + SSH_PORT: ${{ secrets.SSH_PORT }} + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + + steps: + - name: Checkout to branch + uses: actions/checkout@v4 + - id: deploy + name: Pull Request Deploy + uses: hngprojects/pr-deploy@staging + with: + server_host: ${{ env.SSH_HOST }} + server_username: ${{ env.SSH_USERNAME }} + server_password: ${{ secrets.SERVER_PASSWORD }} + server_port: ${{ env.SSH_PORT }} + comment: true + context: '.' + dockerfile: 'Dockerfile' + exposed_port: '8019' + # 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 }}" \ No newline at end of file