-
Notifications
You must be signed in to change notification settings - Fork 30
71 lines (69 loc) · 2.41 KB
/
Copy pathpreview-build.yml
File metadata and controls
71 lines (69 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
---
#
# Copyright (c) 2020 Red Hat, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
#
# GitHub Actions configuration file to
# 1. Build the project with Antora
# 2. Prepare the preview publication
# 3. Validate the internal and external links
name: Preview build
on:
- pull_request
jobs:
preview-build:
name: Preview build
runs-on: ubuntu-latest
container: quay.io/antoraformodulardocs/antora-for-modular-docs:main
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0 # enable git diff and building many branches
# Cache for Antora UI and Htmltest.
# See: https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows
# Htmltest accepts 2 weeks old cache for the status code of checked external URLs
# See: https://github.com/wjdp/htmltest
# Refresh the cache every week to avoid a stale cache for htmltest
# See: https://github.com/actions/cache
# See: http://man7.org/linux/man-pages/man1/date.1.html
- name: Get yearweek for cache
id: get-date # used below
run: echo "::set-output name=yearweek::$(/bin/date -u "+%Y%U")"
shell: bash
- name: Restore cache
uses: actions/cache@v2
env:
cache-name: cache
with:
path: .cache
key: ${{ steps.get-date.outputs.yearweek }}
- name: Build
run: tools/publication-builder.sh
- name: Store pull request details for preview-publish
run: |
echo "${{ github.event.number }}" > PR_NUMBER
echo "${{ github.event.pull_request.head.sha }}" > PR_SHA
- name: Upload preview-build artifact
uses: actions/upload-artifact@v2
with:
name: preview-build
path: |
build
PR_NUMBER
PR_SHA
retention-days: 7
- name: Validate internal and external links
run: htmltest
- name: Validate language changes
run: |
tools/get-vale-styles.sh
tools/validate-language-changes.sh
- name: Validate shell scripts changes
run: tools/validate-shell-scripts.sh