Update PLZ links to Grafana Cloud docs #2812
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v3 | |
- name: Use Node.js 16.xs | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
registry-url: 'https://registry.npmjs.org' | |
cache: 'npm' | |
- name: Restore cache | |
uses: actions/cache@v3 | |
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@v3 | |
- 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@v3 | |
- 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 16.xs | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
registry-url: 'https://registry.npmjs.org' | |
cache: 'npm' | |
- name: Restore node_modules cache | |
uses: actions/cache@v3 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }} | |
- name: Install | |
run: npm install | |
- name: Restore build cache | |
uses: actions/cache@v3 | |
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/*' | |
- name: Post published URL to PR | |
# Run only if we did not skip the upload step and it's the first run for this PR. | |
if: steps.upload.outcome == 'success' && github.event.action == 'opened' | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.payload.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: | |
"There's a version of the docs published here:\n\n" + | |
`${process.env.GATSBY_DEFAULT_DOC_URL}\n\n` + | |
'It will be deleted automatically in 30 days.', | |
}) |