Skip to content

Commit

Permalink
Merge branch 'master' into gitlab_auth
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalMaler authored Mar 26, 2021
2 parents 96ea78b + 443347a commit 62364b4
Show file tree
Hide file tree
Showing 10 changed files with 209 additions and 180 deletions.
102 changes: 102 additions & 0 deletions .github/workflows/build-and-validate-on-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#
# Copyright (c) 2020 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#

name: Build and validate
on:
- pull_request
jobs:
build:
name: link checker # This job name is set as mandatory in the GitHub configuration.
runs-on: ubuntu-20.04
container: "quay.io/eclipse/che-docs:latest"
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 # Necessary for git diff in vale step

- name: Build using antora
id: antora-build
run: CI=true antora generate antora-playbook.yml --stacktrace

- name: Upload artifact doc-content
uses: actions/upload-artifact@v2
with:
name: doc-content
path: build/site

- name: Store PR info for publish-netlify
run: |
echo "${{ github.event.number }}" > PR_NUMBER
echo "${{ github.event.pull_request.head.sha }}" > PR_SHA
- name: Upload artifact pull-request-number for publish-netlify
uses: actions/upload-artifact@v2
with:
name: pull-request-number
path: PR_NUMBER

- name: Upload artifact pull-request-sha for publish-netlify
uses: actions/upload-artifact@v2
with:
name: pull-request-sha
path: PR_SHA

# htmltest:
# name: link checker # This name is set as mandatory in the GitHub configuration.
# runs-on: ubuntu-20.04
# container: "quay.io/eclipse/che-docs:latest"
# needs: build
# steps:
# - name: Checkout code
# uses: actions/checkout@v2

# - name: Download artifacts
# uses: actions/download-artifact@v2
# with:
# name: doc-content

- name: Cache htmltest status code of checked external URLs # See: https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows
uses: actions/cache@v2
env:
cache-name: cache-htmltest
with:
key: refcache.json
path: .cache/htmltest

- name: Validate links using htmltest
id: validate-links
run: htmltest

# unusedimages:
# name: Report unused images
# runs-on: ubuntu-20.04
# steps:
# - name: Checkout code
# uses: actions/checkout@v2

- name: Report Unused Images
run: tools/detect-unused-images.sh

# vale-diff:
# name: Validate language on new and modified files in PR
# runs-on: ubuntu-20.04
# container: "quay.io/eclipse/che-docs:latest"
# steps:
# - name: Checkout code
# uses: actions/checkout@v2
# with:
# fetch-depth: 0

- name: Validate language on files added or modified
run: |
vale -v
echo "Changed files, in comparison to branch $GITHUB_BASE_REF"
git diff --name-only --diff-filter=AM origin/$GITHUB_BASE_REF
vale $(git diff --name-only --diff-filter=AM origin/$GITHUB_BASE_REF)
83 changes: 83 additions & 0 deletions .github/workflows/build-and-validate-on-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#
# Copyright (c) 2020 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#

# GitHub Actions configuration file for htmltest
# See: https://github.com/wjdp/htmltest

name: Build and validate documentation on push
on:
- push
jobs:
build:
name: Build the documentation
runs-on: ubuntu-20.04
container: "quay.io/eclipse/che-docs:latest"
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Build using antora
id: antora-build
run: CI=true antora generate antora-playbook.yml --stacktrace

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: doc-content
path: build/site

htmltest:
name: link checker # This name is set as mandatory in the GitHub configuration.
runs-on: ubuntu-20.04
container: "quay.io/eclipse/che-docs:latest"
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Cache htmltest status code of checked external URLs # See: https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows
uses: actions/cache@v2
env:
cache-name: cache-htmltest
with:
key: refcache.json
path: .cache/htmltest

- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: doc-content

- name: Check internal and external links using htmltest
id: validate-links
run: htmltest

vale-all-content:
name: Validate style on all content on push
runs-on: ubuntu-20.04
container: "quay.io/eclipse/che-docs:latest"
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Vale
run: |
vale -v
vale .
unusedimages:
name: Report unused images
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Detect Unused Images
run: tools/detect-unused-images.sh
39 changes: 0 additions & 39 deletions .github/workflows/build-pr-docs.yaml

This file was deleted.

16 changes: 0 additions & 16 deletions .github/workflows/che.yaml

This file was deleted.

38 changes: 0 additions & 38 deletions .github/workflows/link-checker.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
#
# Copyright (c) 2020 Red Hat, Inc.
# This program and the accompanying materials are made
Expand All @@ -7,7 +8,9 @@
# SPDX-License-Identifier: EPL-2.0
#

name: Publish Doc Content
# NOTE: Because this worklow is using secrets, it cannot run directly on a pull-request workflow, which is running in the context of the forked repository.

name: Publish doc-content using netlify

on:
workflow_run:
Expand All @@ -17,49 +20,55 @@ on:

jobs:
publish:
name: publish
name: Publish doc-content using netlify
runs-on: ubuntu-20.04
steps:
- name: download doc artifact
- name: Download doc-content artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
name: doc-content
path: content
- name: PR number

- name: Download pull-request-number artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
name: pull-request-number
- name: Grab pull request number

- name: Set PR_NUMBER variable
run: |
pr_number=$(cat "PR_NUMBER")
if ! [[ "$pr_number" =~ ^[0-9]+$ ]]; then
echo "pr number invalid"
exit 1
fi
echo "PR_NUMBER=$pr_number" >> $GITHUB_ENV
- name: PR sha
- name: Download pull-request-sha artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
name: pull-request-sha
- name: Grab pull request sha1

- name: Set PR_SHA variable
run: |
pr_sha=$(cat "PR_SHA")
echo "PR_SHA=$pr_sha" >> $GITHUB_ENV
- name: Publish
- name: Publish doc-content using netlify
uses: netlify/actions/cli@master
id: netlify-publish
with:
args: deploy --dir=content --functions=functions
env:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
- name: 'Comment PR'

- name: Comment the pull-request
uses: actions/github-script@v3.0.0
with:
script: |
const { repo: { owner, repo } } = context;
const netlifyUrl = '${{ steps.netlify-publish.outputs.NETLIFY_URL }}';
await github.repos.createCommitStatus({ owner, repo, sha: process.env.PR_SHA, state: "success", target_url: netlifyUrl, description: "Browse PR documentation online", context: "browse built doc"})
script: |
const { repo: { owner, repo } } = context;
const netlifyUrl = '${{ steps.netlify-publish.outputs.NETLIFY_URL }}';
await github.repos.createCommitStatus({ owner, repo, sha: process.env.PR_SHA, state: "success", target_url: netlifyUrl, description: "Browse PR documentation online", context: "browse built doc"})
20 changes: 0 additions & 20 deletions .github/workflows/unused-images.yaml

This file was deleted.

Loading

0 comments on commit 62364b4

Please sign in to comment.