diff --git a/.github/workflows/preview-deploy.yml b/.github/workflows/preview-deploy.yml deleted file mode 100644 index cc725c302..000000000 --- a/.github/workflows/preview-deploy.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: preview-deploy - -on: - workflow_call: ~ - workflow_run: - workflows: [preview-build] - types: - - completed - -permissions: - contents: none - id-token: write - deployments: write - actions: read - -jobs: - do-nothing: - runs-on: ubuntu-latest - steps: - - name: Do nothing - run: echo "This is here for backwards compatibility. After validating that the preview-build workflow is working as expected, you can remove this workflow file." diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml deleted file mode 100644 index 4e55338f9..000000000 --- a/.github/workflows/preview.yml +++ /dev/null @@ -1,97 +0,0 @@ -name: preview - -on: - workflow_call: - inputs: - strict: - description: 'Treat warnings as errors' - type: boolean - default: true - continue-on-error: - description: 'Do not fail to publish if build fails' - type: boolean - required: false - default: true # default for will be false after migration - -permissions: - id-token: write - deployments: write - contents: read - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - name: Create Deployment - uses: actions/github-script@v7 - id: deployment - with: - result-encoding: string - script: | - const { owner, repo } = context.repo; - const deployment = await github.rest.repos.createDeployment({ - owner, - repo, - ref: context.payload.pull_request.head.ref, - environment: `docs-preview-${context.issue.number}`, - auto_merge: false, - required_contexts: [], - }) - await github.rest.repos.createDeploymentStatus({ - deployment_id: deployment.data.id, - owner, - repo, - state: "in_progress", - log_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}?pr=${context.issue.number}`, - }) - return deployment.data.id - - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} - - - uses: actions/download-artifact@v4 - if: github.repository == 'elastic/docs-builder' - with: - name: docs-builder-binary - - # we run our artifact directly please use the prebuild - # elastic/docs-builder@main GitHub Action for all other repositories! - - name: Build documentation - if: github.repository == 'elastic/docs-builder' - env: - PR_NUMBER: - run: | - chmod +x ./docs-builder - ./docs-builder --strict --path-prefix "/${GITHUB_REPOSITORY}/pull/${{ github.event.pull_request.number }}" - - - name: Build documentation - if: github.repository != 'elastic/docs-builder' - uses: elastic/docs-builder@main - continue-on-error: ${{ inputs.continue-on-error == 'true' }} # Will be removed after the migration phase - with: - prefix: "/${{ github.repository }}/pull/${{ github.event.pull_request.number }}" - strict: ${{ inputs.strict }} - - - uses: elastic/docs-builder/.github/actions/aws-auth@main - - - name: Upload to S3 - env: - PR_NUMBER: ${{ github.event.pull_request.number }} - run: | - aws s3 sync .artifacts/docs/html "s3://elastic-docs-v3-website-preview/${GITHUB_REPOSITORY}/pull/${PR_NUMBER}" --delete - aws cloudfront create-invalidation --distribution-id EKT7LT5PM8RKS --paths "/${GITHUB_REPOSITORY}/pull/${PR_NUMBER}/*" - - - name: Update deployment status - uses: actions/github-script@v7 - if: always() && steps.deployment.outputs.result - with: - script: | - await github.rest.repos.createDeploymentStatus({ - owner: context.repo.owner, - repo: context.repo.repo, - deployment_id: ${{ steps.deployment.outputs.result }}, - state: "${{ job.status == 'success' && 'success' || 'failure' }}", - environment_url: `https://docs-v3-preview.elastic.dev/${context.repo.owner}/${context.repo.repo}/pull/${context.issue.number}`, - log_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}?pr=${context.issue.number}`, - })