This repository has been archived by the owner on Jul 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
108 lines (86 loc) · 2.81 KB
/
check-docs.yaml
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: PR checks
on:
pull_request:
permissions:
packages: write
actions: write
jobs:
docker:
name: Prepare Docker image
runs-on: ubuntu-22.04
outputs:
docker_image: ${{ steps.docker-image-tag.outputs.docker_image }}
steps:
- uses: actions/checkout@v4
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- name: Determine Docker image name and tag
id: docker-image-tag
run: |
DOCKER_REPO_NAME=`echo ${GITHUB_REPOSITORY} | tr '[:upper:]' '[:lower:]'`
DOCKER_CHECKSUM=`cat Dockerfile scripts/dot2svg.sh scripts/sphinx.sh | sha256sum | awk '{ print $1 }' | tr -d '\n'`
DOCKER_IMAGE=ghcr.io/${DOCKER_REPO_NAME}/builder:${DOCKER_CHECKSUM}
echo "docker_image=${DOCKER_IMAGE}" >> $GITHUB_OUTPUT
echo "DOCKER_IMAGE=${DOCKER_IMAGE}" >> $GITHUB_ENV
- name: Check if Docker image exists
id: check-docker-image
continue-on-error: true
env:
DOCKER_CLI_EXPERIMENTAL: enabled
run: docker manifest inspect ${{ env.DOCKER_IMAGE }}
- name: Build Docker image
if: steps.check-docker-image.outcome == 'failure'
uses: docker/build-push-action@v5
with:
context: .
tags: ${{ env.DOCKER_IMAGE }}
push: true
build:
runs-on: ubuntu-22.04
needs: [docker]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- name: Pull Docker image
run: |
docker pull ${{ needs.docker.outputs.docker_image }}
echo "DOCKER_IMAGE=${{ needs.docker.outputs.docker_image }}" >> $GITHUB_ENV
- name: Determine documentation release
run: |
echo "VERSION=${{ github.head_ref }}" >> $GITHUB_ENV
echo "RELEASE=${{ github.sha }}" >> $GITHUB_ENV
- name: Build docs
run: make html
- run: make check
- uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: asset-tracker-docs-${{ github.sha }}
path: build/html/
test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: "npm"
- name: Install dependencies
run: npm ci --no-audit
- name: Compile TypeScript
run: npx tsc
- name: Test
run: npm test