From cb4f399d473dd8916eed526ebe0367ac39bfe4b6 Mon Sep 17 00:00:00 2001 From: Karl Cardenas Date: Fri, 27 Oct 2023 07:39:37 -0700 Subject: [PATCH] ci: cherry-pick of version-3-4 --- .backportrc.json | 2 +- .github/workflows/pull_request.yaml | 1 + .github/workflows/release.yaml | 51 ++++++++++++++++++-- .github/workflows/version-branch-update.yaml | 2 - archiveVersions.json | 3 ++ 5 files changed, 51 insertions(+), 8 deletions(-) create mode 100644 archiveVersions.json diff --git a/.backportrc.json b/.backportrc.json index 1d0daf7b32..7ec757378a 100644 --- a/.backportrc.json +++ b/.backportrc.json @@ -3,7 +3,7 @@ "repoName": "librarium", "editor": "code", - "targetBranchChoices": ["master", "version-4-0", "version-3-4"], + "targetBranchChoices": ["master", "version-4-1", "version-4-0", "version-3-4"], "autoMerge": true, "autoMergeMethod": "squash", diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index df2a61e464..4c32500f3f 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -23,6 +23,7 @@ env: jobs: run-ci: + # runs-on: ubuntu-latest runs-on: ubuntu-latest defaults: run: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index bc3e36f059..942e400f0d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -4,10 +4,15 @@ name: Release to Production # or a version branch (e.g. version-4-0) on: - push: - branches: ['master', 'version-**'] + schedule: + - cron: '0 20 * * 1-5' # At 12:00 PM PST (8 PM UTC), Monday through Friday + - cron: '0 5 * * 2-6' # At 9:00 PM PST (5 AM UTC next day), Monday through Friday workflow_dispatch: - + inputs: + useGitHubHostedLargeRunner: + description: 'Use the GitHub-hosted large runner. Allowed values are true or false. Caution - this results in additional charges to the organization.' + required: false + default: false env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -27,7 +32,8 @@ concurrency: cancel-in-progress: true jobs: - build: +# This is the default workflow that uses the self-hosted runner. The self-hosted runner is slower than the GitHub-hosted large runner, but it does not incurr additional charges. + build-self-hosted-runner: name: Build Website runs-on: group: 'Doc Runners' @@ -59,9 +65,44 @@ jobs: aws s3 sync --cache-control 'public, max-age=0, s-maxage=604800' build/ s3://docs.spectrocloud.com --delete aws cloudfront create-invalidation --distribution-id ${{ secrets.DISTRIBUTION_ID }} --paths "/*" +# Use this workflow if you want to use the GitHub-hosted large runner. Useful for scenarios when you need a change to deploy faster than the self-hosted runner can build it. + build-large-runner: + name: Build Website + runs-on: + group: 'Doc Runners' + labels: docbot + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: "master" + + + - name: Setup Node.js environment + uses: actions/setup-node@v3 + with: + node-version: "18" + cache: "npm" + + - run: npm ci + + - name: Compile + run: | + make versions-ci + make build + + - name: Upload to AWS + run: | + aws s3 sync --cache-control 'public, max-age=604800' --exclude '*.html' --exclude '*.xml' --exclude build/scripts/ build/ s3://docs.spectrocloud.com --delete + aws s3 sync --cache-control 'public, max-age=0, s-maxage=604800' build/ s3://docs.spectrocloud.com --delete + aws cloudfront create-invalidation --distribution-id ${{ secrets.DISTRIBUTION_ID }} --paths "/*" + + release: name: "Release" - needs: [build] + if: always() && (needs.build-large-runner.result == 'success' || needs.build-self-hosted-runner.result == 'success') + needs: [build-self-hosted-runner,build-large-runner] runs-on: ubuntu-latest steps: - id: checkout diff --git a/.github/workflows/version-branch-update.yaml b/.github/workflows/version-branch-update.yaml index 1b108d7c2e..6f67c5e8f5 100644 --- a/.github/workflows/version-branch-update.yaml +++ b/.github/workflows/version-branch-update.yaml @@ -4,8 +4,6 @@ on: pull_request: branches: - 'version-[0-9]-[0-9]' - types: [opened, synchronize, reopened] - workflow_dispatch: diff --git a/archiveVersions.json b/archiveVersions.json new file mode 100644 index 0000000000..e38eb1ccd5 --- /dev/null +++ b/archiveVersions.json @@ -0,0 +1,3 @@ +{ + "v3.4.x and prior": "https://version-3-4.legacy.docs.spectrocloud.com" +} \ No newline at end of file