From bf4ed7ad8bf03ddec8d20361ed0dd7db3e27941c Mon Sep 17 00:00:00 2001 From: Joshua Fernandes Date: Wed, 19 Jun 2024 10:37:33 +1000 Subject: [PATCH] With the move to Vercel, remove the GHA that push to gh-pages (#1349) --- .github/workflows/delete-preview.yml | 42 --------------- .github/workflows/publish-docs.yml | 44 --------------- .github/workflows/publish-main-docs.yml | 14 ----- .github/workflows/publish-preview.yml | 72 ------------------------- 4 files changed, 172 deletions(-) delete mode 100644 .github/workflows/delete-preview.yml delete mode 100644 .github/workflows/publish-docs.yml delete mode 100644 .github/workflows/publish-main-docs.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 5c1db6ad57c..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 == 'false' && github.event.pull_request.head.ref != 'wallet' && github.event.pull_request.head.ref != 'snaps' && github.event.pull_request.head.ref != 'guide' && github.event.pull_request.head.ref != 'assets' && github.event.pull_request.head.ref != 'img' && github.event.pull_request.head.ref != 'search' }} - 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-docs.yml b/.github/workflows/publish-docs.yml deleted file mode 100644 index 320c52c8769..00000000000 --- a/.github/workflows/publish-docs.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Publish docs to GitHub Pages - -on: - workflow_call: - inputs: - destination_dir: - type: string - ref: - required: false - type: string - secrets: - SEGMENT_ANALYTICS_KEY: - required: true - -jobs: - publish-docs-to-gh-pages: - name: Publish docs to GitHub Pages - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - name: Checkout the repository - uses: actions/checkout@v3 - with: - ref: ${{ inputs.ref }} - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version-file: '.nvmrc' - cache: 'yarn' - - name: Install npm dependencies - run: yarn --immutable - - name: Run build script - env: - SEGMENT_ANALYTICS_KEY: ${{ secrets.SEGMENT_ANALYTICS_KEY }} - run: DEST="/${{ inputs.destination_dir }}" yarn build - - name: Deploy to `${{ inputs.destination_dir }}` directory of `gh-pages` branch - uses: peaceiris/actions-gh-pages@068dc23d9710f1ba62e86896f84735d869951305 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./build - destination_dir: ${{ inputs.destination_dir }} - keep_files: true - diff --git a/.github/workflows/publish-main-docs.yml b/.github/workflows/publish-main-docs.yml deleted file mode 100644 index 5f6ea5bf9b6..00000000000 --- a/.github/workflows/publish-main-docs.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Publish main branch docs to GitHub Pages - -on: - push: - branches: main - -jobs: - publish-to-gh-pages: - name: Publish docs to `./` directory of `gh-pages` branch - permissions: - contents: write - uses: ./.github/workflows/publish-docs.yml - secrets: - SEGMENT_ANALYTICS_KEY: ${{ secrets.SEGMENT_ANALYTICS_KEY }} \ No newline at end of file diff --git a/.github/workflows/publish-preview.yml b/.github/workflows/publish-preview.yml deleted file mode 100644 index a5360ff01b4..00000000000 --- a/.github/workflows/publish-preview.yml +++ /dev/null @@ -1,72 +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 don't publish on forks. We can't trust forks to publish on our domain. - # also ensures we dont publish previews to folders that are already used - if: ${{ needs.is-fork-pull-request.outputs.IS_FORK == 'false' && github.event.pull_request.head.ref != 'wallet' && github.event.pull_request.head.ref != 'snaps' && github.event.pull_request.head.ref != 'guide' && github.event.pull_request.head.ref != 'assets' && github.event.pull_request.head.ref != 'img' && github.event.pull_request.head.ref != 'search' }} - 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 }} - secrets: - SEGMENT_ANALYTICS_KEY: ${{ secrets.SEGMENT_ANALYTICS_DEV_KEY }} - - 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://docs.metamask.io/${{ github.head_ref }}/)" - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR_NUMBER: ${{ github.event.pull_request.number }}