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

GitHub Workflows reorganization. #1927

Merged
merged 7 commits into from
Mar 26, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 155 additions & 0 deletions .github/workflows/build-and-validate-on-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
#
# 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 documentation on pull request
on:
- pull_request
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 doc-content
uses: actions/upload-artifact@v2
with:
name: doc-content
path: build/site

- name: Store PR info
run: |
echo "${{ github.event.number }}" > PR_NUMBER
echo "${{ github.event.pull_request.head.sha }}" > PR_SHA

- name: Upload artifact pull-request-number
uses: actions/upload-artifact@v2
with:
name: pull-request-number
path: PR_NUMBER

- name: Upload artifact pull-request-sha
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: 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

publish:
name: Publish
runs-on: ubuntu-20.04
needs: build
steps:
- name: download doc artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
name: doc-content
path: content

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

- name: Grab pull request number
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
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
name: pull-request-sha

- name: Grab pull request sha1
run: |
pr_sha=$(cat "PR_SHA")
echo "PR_SHA=$pr_sha" >> $GITHUB_ENV

- name: Publish
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"
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"})

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: Vale
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)

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
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.

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

This file was deleted.

65 changes: 0 additions & 65 deletions .github/workflows/publish-netlify.yaml

This file was deleted.

Loading