From ab205468c4eb909dd11663c78bea697dfd4948ba Mon Sep 17 00:00:00 2001 From: Alex Marshall Date: Fri, 28 Jul 2023 12:26:18 +0100 Subject: [PATCH 1/3] build(vercel): disable automatic git deployment DOPS-54 Signed-off-by: Alex Marshall --- vercel.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vercel.json b/vercel.json index fbc299fd..f3d63775 100644 --- a/vercel.json +++ b/vercel.json @@ -4,5 +4,8 @@ "buildCommand": "mkdocs build", "github": { "silent": true + }, + "git": { + "deploymentEnabled": false } } From 485a1107a98f47affe6bea061b7328e29aa267ab Mon Sep 17 00:00:00 2001 From: Alex Marshall Date: Mon, 31 Jul 2023 15:54:45 +0100 Subject: [PATCH 2/3] build(github): add workflow to deploy to docs to production on push to main DOPS-54 Signed-off-by: Alex Marshall --- .github/workflows/vercel-production.yaml | 22 ++++++++++++++++++++++ .pre-commit-config.yaml | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/vercel-production.yaml diff --git a/.github/workflows/vercel-production.yaml b/.github/workflows/vercel-production.yaml new file mode 100644 index 00000000..8a86c878 --- /dev/null +++ b/.github/workflows/vercel-production.yaml @@ -0,0 +1,22 @@ +--- +name: Vercel Production Docs Deployment +env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} +on: + push: + branches: + - main +jobs: + Deploy-Production: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install Vercel CLI + run: npm install --global vercel@canary + - name: Pull Vercel Environment Information + run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} + - name: Build Project Artifacts + run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} + - name: Deploy Project Artifacts to Vercel + run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a6764a93..1013f0b1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -88,7 +88,7 @@ repos: rev: v1.29.0 hooks: - id: yamllint - exclude: ".*/templates/.*" + exclude: "^(.github/workflows/*.*)$" - repo: https://github.com/IamTheFij/docker-pre-commit rev: v2.1.1 hooks: From e433bec21daa4754d430a746f3a601f2a7df655e Mon Sep 17 00:00:00 2001 From: Alex Marshall Date: Tue, 8 Aug 2023 15:42:22 +0100 Subject: [PATCH 3/3] build(github): add workflow to deploy to docs to preview on push to tagged pr Signed-off-by: Alex Marshall --- .github/workflows/vercel-preview.yaml | 44 +++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/vercel-preview.yaml diff --git a/.github/workflows/vercel-preview.yaml b/.github/workflows/vercel-preview.yaml new file mode 100644 index 00000000..3dd67397 --- /dev/null +++ b/.github/workflows/vercel-preview.yaml @@ -0,0 +1,44 @@ +name: Vercel Preview Docs Deployment +env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} +on: + pull_request: + types: + - labeled + - unlabeled + - synchronize + - opened + - edited + - ready_for_review + +jobs: + Deploy-Preview: + if: contains(github.event.pull_request.labels.*.name, 'documentation') || contains (github.label, 'documentation') + runs-on: ubuntu-latest + steps: + - id: step1 + uses: actions/checkout@v2 + - id: step2 + name: Install Vercel CLI + run: npm install --global vercel@canary + - id: step3 + name: Pull Vercel Environment Information + run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} + - id: step4 + name: Build Project Artifacts + run: vercel build --token=${{ secrets.VERCEL_TOKEN }} + - id: step5 + name: Deploy Project Artifacts to Vercel and get preview URL + run: echo preview="$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} )" >> $GITHUB_ENV + - id: step6 + name: Comment with Preview URL + uses: actions/github-script@v6 + with: + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: `Docs preview: ${{ env.preview }}` + })