Skip to content

Release v0.51.x documentation #3243

Release v0.51.x documentation

Release v0.51.x documentation #3243

Workflow file for this run

name: Pull Request CI
env:
PATH_PREFIX: /docs/${{ github.ref }}
GATSBY_DEFAULT_MAIN_URL: https://staging.k6.io
GATSBY_DEFAULT_DOC_URL: https://mdr-ci.staging.k6.io/docs/${{ github.ref }}
GATSBY_DEFAULT_BLOG_URL: https://k6.io/blog
GATSBY_DEFAULT_APP_URL: https://app.staging.k6.io
GATSBY_NEWSLETTER_FORM_URL: https://go2.grafana.com
GATSBY_NEWSLETTER_FORM_MUNCHKIN_ID: 356-YFG-389
GATSBY_NEWSLETTER_FORM_ID: 1420
on:
pull_request:
branches: main
jobs:
lint:
name: Lint code
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Use Node.js 20.xs
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
- name: Restore cache
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm install
- name: Check formatting
run: |
npm run format
- name: Lint code
run: |
npm run lint
- name: Lint code examples
run: |
npm run lint:examples
lint-prose:
name: Lint prose
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: errata-ai/vale-action@reviewdog
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
files: ./src/data/markdown
version: 2.17.0
fail_on_error: true
vale_flags: '--glob=**/{docs,translated-guides/en}/**/*.md'
build:
name: Build and deploy pull request
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v4
- name: Print build settings
run: |
echo "PATH_PREFIX: $PATH_PREFIX"
echo "GATSBY_DEFAULT_MAIN_URL: $GATSBY_DEFAULT_MAIN_URL"
echo "GATSBY_DEFAULT_DOC_URL: $GATSBY_DEFAULT_DOC_URL"
echo "GATSBY_DEFAULT_BLOG_URL: $GATSBY_DEFAULT_BLOG_URL"
echo "GATSBY_DEFAULT_APP_URL: $GATSBY_DEFAULT_APP_URL"
- name: Use Node.js 20.xs
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
- name: Restore node_modules cache
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install
run: npm install
- name: Restore build cache
uses: actions/cache@v4
with:
# Gatsby requires both .cache and public. It will refuse to use .cache/ if public/ is not present.
path: |
.cache
public
# Cache will not be used by Gatsby if the following files change:
# https://www.gatsbyjs.com/docs/build-caching/
key: pr-gatsby-${{ hashFiles('package.json', 'gatsby-config.js', 'gatsby-node.js') }}-${{ github.ref }}
restore-keys: |
pr-gatsby-${{ hashFiles('package.json', 'gatsby-config.js', 'gatsby-node.js') }}-
- name: Build
run: npm run build
- name: Sync to S3
id: upload
# Run only if PR does not come from a fork and it is not from dependabot.
if: github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]'
uses: jakejarvis/[email protected]
with:
args: --delete
env:
AWS_ACCESS_KEY_ID: ${{ secrets.PR_CI_AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.PR_CI_AWS_SECRET_KEY }}
AWS_REGION: 'eu-west-1'
AWS_S3_BUCKET: ${{ secrets.PR_CI_AWS_S3_BUCKET }}
SOURCE_DIR: public/
DEST_DIR: docs/${{ github.ref }}
- name: Invalidate Cloudfront
# Run only if we did not skip the upload step
if: steps.upload.outcome == 'success'
uses: chetan/[email protected]
env:
AWS_ACCESS_KEY_ID: ${{ secrets.PR_CI_AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.PR_CI_AWS_SECRET_KEY }}
AWS_REGION: 'eu-west-1'
DISTRIBUTION: ${{ secrets.PR_CI_CLOUDFRONT_DISTRIBUTION_ID }}
PATHS: '/docs/*'