Some checks failed
Server CI / Postgres (shard 0) (push) Has been skipped
Server CI / Postgres (shard 3) (push) Has been skipped
BuildEnv Docker Image / build-image (push) Failing after 4s
BuildEnv Docker Image / build-image-fips (push) Failing after 4s
Migration Review & Release Notes / Generate migration review & release notes (push) Failing after 3s
Server CI / Build Environment (push) Failing after 3s
Server CI / Postgres (shard 1) (push) Has been skipped
Tools CI / check-style (mattermost-govet) (push) Failing after 4s
Server CI / Postgres (shard 2) (push) Has been skipped
Tools CI / check-style (mmgotool) (push) Failing after 3s
Server CI / Elasticsearch v8 Compatibility (push) Has been skipped
Server CI / OpenSearch v2 Compatibility (push) Has been skipped
Server CI / Postgres FIPS (shard 0) (push) Has been skipped
Tools CI / Test (mattermost-govet) (push) Failing after 3s
Server CI / Postgres FIPS (shard 1) (push) Has been skipped
Server CI / Postgres FIPS (shard 2) (push) Has been skipped
Tools CI / Test (mmgotool) (push) Failing after 3s
Server CI / Postgres FIPS (shard 3) (push) Has been skipped
Server CI / Run mmctl tests (push) Has been skipped
Server CI / Run mmctl tests (FIPS) (push) Has been skipped
Server CI / Merge Postgres Test Results (push) Has been skipped
Server CI / Merge Postgres FIPS Test Results (push) Has been skipped
Server CI / Check backport migrations (push) Has been skipped
Server CI / Check generated files (push) Has been skipped
Server CI / check-style (push) Has been skipped
Server CI / Vet API (push) Has been skipped
Server CI / Build mattermost server app (push) Has been skipped
Server CI / Server CI Complete (push) Failing after 2s
Server CI / Server CI Artifacts (push) Has been skipped
Server CI / Sentry Upload (push) Has been skipped
Server CI / Server CI Report (push) Failing after 5m1s
Server CI Nightly Race / Race Detector (push) Has been skipped
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Webapp CI Cache Warm / Warm Webapp node_modules Cache (push) Has been cancelled
E2E CI Cache Warm / Warm E2E npm Registry Cache (push) Has been cancelled
API / build (push) Has been cancelled
Web App CI / check-types (push) Has been cancelled
Web App CI / check-lint (push) Has been cancelled
Web App CI / check-i18n (push) Has been cancelled
Web App CI / check-external-links (push) Has been cancelled
Web App CI / test (platform) (push) Has been cancelled
Web App CI / test (mattermost-redux) (push) Has been cancelled
Web App CI / test (channels shard 1/4) (push) Has been cancelled
Web App CI / test (channels shard 2/4) (push) Has been cancelled
Web App CI / test (channels shard 3/4) (push) Has been cancelled
Web App CI / test (channels shard 4/4) (push) Has been cancelled
Web App CI / upload-coverage (push) Has been cancelled
Web App CI / build (push) Has been cancelled
YAML Lint / yamllint (push) Has been cancelled
Push mirrored docker images / cd/Push mirrored docker images (push) Has been cancelled
docs-cd / Build and deploy docs (push) Has been cancelled
Docs CI / build (push) Has been cancelled
E2E Cache Warm: Cypress deps / Warm Cypress deps cache (push) Has been cancelled
Scorecards supply-chain security / Scorecard analysis (push) Has been cancelled
Server CI Weekly / Postgres FIPS (push) Has been skipped
Server CI Weekly / Run mmctl tests (FIPS) (push) Has been skipped
Server CI Weekly / Postgres with binary parameters (push) Has been skipped
Server CI Weekly / Build Environment (push) Failing after 1s
Server CI Cache Warm / Warm Go Module and Build Cache (push) Failing after 2s
Server CI Nightly Race / Build Environment (push) Failing after 1s
137 lines
4.7 KiB
YAML
137 lines
4.7 KiB
YAML
name: docs-preview-template
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
PR_NUMBER:
|
|
type: string
|
|
required: true
|
|
COMMIT_SHA:
|
|
type: string
|
|
required: true
|
|
# Commit status context shown on the PR. Details (⋯) links to the preview
|
|
# when status is success. Empty skips status updates.
|
|
STATUS_CONTEXT:
|
|
type: string
|
|
required: false
|
|
default: docs-preview
|
|
secrets:
|
|
AWS_DOCS_PR_PREVIEW_KEY_ID:
|
|
required: true
|
|
AWS_DOCS_PR_PREVIEW_SECRET_ACCESS_KEY:
|
|
required: true
|
|
|
|
# Serialize runs per PR so an older, slower build can't overwrite a newer
|
|
# upload; different PRs still build concurrently.
|
|
concurrency:
|
|
group: docs-preview-${{ inputs.PR_NUMBER }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
statuses: write
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
ref: ${{ inputs.COMMIT_SHA }}
|
|
submodules: true
|
|
persist-credentials: false
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
|
with:
|
|
node-version-file: docs/site/.nvmrc
|
|
cache: npm
|
|
cache-dependency-path: docs/site/package-lock.json
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
|
|
with:
|
|
go-version-file: api/server/go.mod
|
|
|
|
- name: Install npm dependencies
|
|
working-directory: docs/site
|
|
run: npm ci
|
|
|
|
- name: Typecheck
|
|
working-directory: docs/site
|
|
run: npm run typecheck
|
|
|
|
- name: Build Docusaurus site (preview)
|
|
working-directory: docs/site
|
|
env:
|
|
BASE_URL: /mattermost/pr-${{ inputs.PR_NUMBER }}/
|
|
run: npm run build
|
|
|
|
- name: Configure AWS credentials
|
|
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
|
|
with:
|
|
aws-access-key-id: ${{ secrets.AWS_DOCS_PR_PREVIEW_KEY_ID }}
|
|
aws-secret-access-key: ${{ secrets.AWS_DOCS_PR_PREVIEW_SECRET_ACCESS_KEY }}
|
|
aws-region: us-east-1
|
|
|
|
- name: Upload preview to S3
|
|
# Repo-scoped prefix (mattermost/) — this bucket is shared
|
|
# with mattermost/docs previews during the migration transition, and
|
|
# PR numbers are per-repo, not global.
|
|
#
|
|
# No explicit --cache-control, matching mattermost/docs's existing
|
|
# preview workflow (shallwefootball/s3-upload-action doesn't set one
|
|
# either).
|
|
env:
|
|
PR_NUMBER: ${{ inputs.PR_NUMBER }}
|
|
BUCKET_NAME: ${{ vars.DOCS_PREVIEW_BUCKET_NAME }}
|
|
run: |
|
|
if ! [[ "$PR_NUMBER" =~ ^[0-9]+$ ]]; then
|
|
echo "PR_NUMBER must be a positive integer, got: $PR_NUMBER" >&2
|
|
exit 1
|
|
fi
|
|
aws s3 sync docs/site/build/ \
|
|
"s3://${BUCKET_NAME}/mattermost/pr-${PR_NUMBER}/" \
|
|
--delete \
|
|
--no-progress
|
|
|
|
- name: Set preview URL
|
|
id: preview
|
|
env:
|
|
BUCKET_NAME: ${{ vars.DOCS_PREVIEW_BUCKET_NAME }}
|
|
PR_NUMBER: ${{ inputs.PR_NUMBER }}
|
|
run: |
|
|
echo "url=http://${BUCKET_NAME}.s3-website-us-east-1.amazonaws.com/mattermost/pr-${PR_NUMBER}/" >> "$GITHUB_OUTPUT"
|
|
|
|
# Details (⋯) on this check links to the preview URL via target_url.
|
|
- name: Set success commit status
|
|
if: ${{ inputs.STATUS_CONTEXT != '' }}
|
|
env:
|
|
COMMIT_SHA: ${{ inputs.COMMIT_SHA }}
|
|
CONTEXT_NAME: ${{ inputs.STATUS_CONTEXT }}
|
|
PREVIEW_URL: ${{ steps.preview.outputs.url }}
|
|
GH_TOKEN: ${{ github.token }}
|
|
GITHUB_REPOSITORY: ${{ github.repository }}
|
|
run: |
|
|
gh api "repos/${GITHUB_REPOSITORY}/statuses/${COMMIT_SHA}" \
|
|
-f state=success \
|
|
-f context="${CONTEXT_NAME}" \
|
|
-f description="Docs preview build for ${COMMIT_SHA} succeeded" \
|
|
-f target_url="$PREVIEW_URL"
|
|
|
|
- name: Set failure commit status
|
|
if: ${{ always() && inputs.STATUS_CONTEXT != '' && (failure() || cancelled()) }}
|
|
env:
|
|
COMMIT_SHA: ${{ inputs.COMMIT_SHA }}
|
|
CONTEXT_NAME: ${{ inputs.STATUS_CONTEXT }}
|
|
GH_TOKEN: ${{ github.token }}
|
|
GITHUB_REPOSITORY: ${{ github.repository }}
|
|
GITHUB_RUN_ID: ${{ github.run_id }}
|
|
run: |
|
|
gh api "repos/${GITHUB_REPOSITORY}/statuses/${COMMIT_SHA}" \
|
|
-f state=failure \
|
|
-f context="${CONTEXT_NAME}" \
|
|
-f description="Docs preview build for ${COMMIT_SHA} failed" \
|
|
-f target_url="https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
|