From 5f5b30068dc9f132c6fa6a1554b0e2d46c76c0ed Mon Sep 17 00:00:00 2001 From: Ry Jones Date: Mon, 10 Jul 2023 11:45:16 -0700 Subject: [PATCH] Remove github preview in favor of Vercel (#1359) Signed-off-by: Ry Jones --- .github/workflows/delete-preview.yml | 42 ---------------- .github/workflows/publish-preview.yml | 69 --------------------------- 2 files changed, 111 deletions(-) delete mode 100644 .github/workflows/delete-preview.yml delete mode 100644 .github/workflows/publish-preview.yml diff --git a/.github/workflows/delete-preview.yml b/.github/workflows/delete-preview.yml deleted file mode 100644 index 670268a7661..00000000000 --- a/.github/workflows/delete-preview.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Delete Branch Folders on gh-pages - -on: - pull_request: - types: [closed] - -jobs: - is-fork-pull-request: - name: Determine whether this pull request is from a fork - runs-on: ubuntu-latest - outputs: - IS_FORK: ${{ steps.is-fork.outputs.IS_FORK }} - steps: - - uses: actions/checkout@v3 - - name: Determine whether this PR is from a fork - id: is-fork - run: echo "IS_FORK=$(gh pr view --json isCrossRepository --jq '.isCrossRepository' "${PR_NUMBER}" )" >> "$GITHUB_OUTPUT" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR_NUMBER: ${{ github.event.pull_request.number }} - - delete_branch_folder_job: - runs-on: ubuntu-latest - needs: is-fork-pull-request - permissions: - contents: write - if: ${{ needs.is-fork-pull-request.outputs.IS_FORK == 'true' }} - steps: - - name: Checkout Repository - uses: actions/checkout@v3 - with: - ref: gh-pages - - name: Delete preview build - env: - BRANCH_NAME: ${{ github.event.pull_request.head.ref }} - run: rm -rf "${BRANCH_NAME}" - - name: Deploy - uses: peaceiris/actions-gh-pages@068dc23d9710f1ba62e86896f84735d869951305 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./ - keep_files: false diff --git a/.github/workflows/publish-preview.yml b/.github/workflows/publish-preview.yml deleted file mode 100644 index 5bf97a498d0..00000000000 --- a/.github/workflows/publish-preview.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Publish a preview build - -on: - pull_request: - types: [opened, synchronize] - -jobs: - is-fork-pull-request: - name: Determine whether this pull request is from a fork - runs-on: ubuntu-latest - outputs: - IS_FORK: ${{ steps.is-fork.outputs.IS_FORK }} - steps: - - uses: actions/checkout@v3 - - name: Determine whether this PR is from a fork - id: is-fork - run: echo "IS_FORK=$(gh pr view --json isCrossRepository --jq '.isCrossRepository' "${PR_NUMBER}" )" >> "$GITHUB_OUTPUT" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR_NUMBER: ${{ github.event.pull_request.number }} - - get-commit-hash: - name: Get the commit hash for the commit being previewed - needs: is-fork-pull-request - # This ensures we publish on forks. - if: ${{ needs.is-fork-pull-request.outputs.IS_FORK == 'true' }} - runs-on: ubuntu-latest - outputs: - COMMIT_SHA: ${{ steps.commit-sha.outputs.COMMIT_SHA }} - steps: - - uses: actions/checkout@v3 - - name: Checkout pull request - run: gh pr checkout "${PR_NUMBER}" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR_NUMBER: ${{ github.event.pull_request.number }} - - name: Get commit SHA - id: commit-sha - run: echo "COMMIT_SHA=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" - - name: Ensure commit hash is not empty - if: ${{ steps.commit-sha.outputs.COMMIT_SHA == '' }} - run: exit 1 - - publish-to-gh-pages: - name: Publish docs to commit hash directory of `gh-pages` branch - needs: get-commit-hash - permissions: - contents: write - uses: ./.github/workflows/publish-docs.yml - with: - destination_dir: ${{ github.head_ref }} - ref: ${{ needs.get-commit-hash.outputs.COMMIT_SHA }} - - post-preview-comment: - name: Post preview in comment - needs: - - get-commit-hash - - publish-to-gh-pages - runs-on: ubuntu-latest - permissions: - pull-requests: write - steps: - - uses: actions/checkout@v3 - - name: Post preview in comment - run: gh pr comment "${PR_NUMBER}" --body "${COMMENT_BODY}" - env: - COMMENT_BODY: "Preview published: [${{ github.head_ref }}](https://besu.hyperledger.org/${{ github.head_ref }}/)" - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR_NUMBER: ${{ github.event.pull_request.number }}