From 736811bfac41afb8ce57d89a7d01199a5af4e530 Mon Sep 17 00:00:00 2001 From: Ramiro Berrelleza Date: Wed, 17 Apr 2024 16:53:28 -0700 Subject: [PATCH] create a preview environment in demo.okteto.dev --- .github/workflows/previews-closed.yaml | 20 ++++++++++++++++++++ .github/workflows/previews.yaml | 24 ++++++++++++++++++++++++ docker-compose.yaml | 9 ++++++++- 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/previews-closed.yaml create mode 100644 .github/workflows/previews.yaml diff --git a/.github/workflows/previews-closed.yaml b/.github/workflows/previews-closed.yaml new file mode 100644 index 000000000..4e335b55e --- /dev/null +++ b/.github/workflows/previews-closed.yaml @@ -0,0 +1,20 @@ +# file: .github/workflows/preview-closed.yaml +on: + pull_request: + types: + - closed + +jobs: + closed: + runs-on: ubuntu-latest + steps: + - name: Context + uses: okteto/context@latest + with: + url: ${{secrets.OKTETO_DEMO_URL}} + token: ${{ secrets.OKTETO_DEMO_TOKEN }} + + - name: Destroy preview environment + uses: okteto/destroy-preview@latest + with: + name: pr-${{ github.event.number }} \ No newline at end of file diff --git a/.github/workflows/previews.yaml b/.github/workflows/previews.yaml new file mode 100644 index 000000000..a00a2f2f1 --- /dev/null +++ b/.github/workflows/previews.yaml @@ -0,0 +1,24 @@ +on: + pull_request: + branches: + - main + +jobs: + preview: + runs-on: ubuntu-latest + steps: + - name: Context + uses: okteto/context@latest + with: + url: ${{secrets.OKTETO_DEMO_URL}} + token: ${{ secrets.OKTETO_DEMO_TOKEN }} + + - name: Deploy preview environment + uses: okteto/deploy-preview@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + name: pr-${{ github.event.number }} + timeout: 15m + + \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index 72eca69c0..cc19b0213 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -3,4 +3,11 @@ services: build: context: . ports: - - "8080:8080" \ No newline at end of file + - "8080:8080" +endpoints: + labels: + dev.okteto.com/endpoints: https://docs-${OKTETO_NAMESPACE}.${OKTETO_DEMO_URL}/docs + rules: + - path: / + service: docs + port: 8080 \ No newline at end of file