forked from stardew-valley-dedicated-server/server
-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (51 loc) · 1.75 KB
/
build-docs.yml
File metadata and controls
61 lines (51 loc) · 1.75 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
name: Build Documentation
on:
workflow_call:
inputs:
version:
description: 'Documentation version (latest or preview)'
required: true
type: string
image_tag:
description: 'Docker image tag to extract OpenAPI spec from'
required: true
type: string
permissions: {}
jobs:
build:
name: Build Documentation (${{ inputs.version }})
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Login to DockerHub
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract OpenAPI spec from Docker image
run: |
docker pull sdvd/server:${{ inputs.image_tag }}
CONTAINER_ID=$(docker create sdvd/server:${{ inputs.image_tag }})
mkdir -p docs/assets
docker cp "$CONTAINER_ID:/data/openapi.json" docs/assets/openapi.json
docker rm "$CONTAINER_ID"
- name: Setup Bun
uses: oven-sh/setup-bun@ecf28ddc73e819eb6fa29df6b34ef8921c743461 # v2.1.3
- name: Install dependencies
run: bun install
working-directory: docs
- name: Build documentation
run: bun run build
working-directory: docs
env:
DOCS_VERSION: ${{ inputs.version }}
- name: Upload artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: docs-${{ inputs.version }}
path: docs/.vitepress/dist
retention-days: 14
overwrite: true