Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI Proposal #1710

Merged
merged 11 commits into from
Oct 27, 2023
2 changes: 1 addition & 1 deletion .backportrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ env:
jobs:
run-ci:
# runs-on: ubuntu-latest
runs-on: ["self-hosted", "linux", "x64", "vcenter3"]
runs-on: ubuntu-latest
defaults:
run:
shell: bash
Expand Down
56 changes: 48 additions & 8 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -27,9 +32,9 @@ 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: ["self-hosted", "linux", "x64", "vcenter3"]
runs-on:
group: 'Doc Runners'
labels: docbot
Expand All @@ -51,18 +56,53 @@ jobs:

- name: Compile
run: |
make versions-ci || ./scripts/versions-ci.sh $TMPDIR
make build || npm run build
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 "/*"

# 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
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/version-branch-update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- 'version-[0-9]-[0-9]'
workflow_dispatch:



Expand Down
2 changes: 1 addition & 1 deletion archiveVersions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"3.4.x and prior": "https://version-3-4.legacy.docs.spectrocloud.com"
"v3.4.x and prior": "https://version-3-4.legacy.docs.spectrocloud.com"
}