Debian Codegraph @

.github/workflows/release-doc.yml

raw symbols SCIP
1 name: Documentation Release
2
3 on:
4 workflow_dispatch:
5 inputs:
6 version:
7 description: "Release version or tag, for example 1.3.0 or ver.1.3.0"
8 required: false
9 push:
10 tags:
11 - "ver.*"
12
13 concurrency:
14 group: ${{ github.workflow }}-${{ github.ref }}
15 cancel-in-progress: true
16
17 jobs:
18 build-doc:
19 runs-on: ubuntu-22.04
20 permissions:
21 contents: write
22 steps:
23 - uses: actions/checkout@v5
24 with:
25 fetch-depth: 0
26
27 - name: Install documentation dependencies
28 run: |
29 sudo apt-get update
30 sudo apt-get install -y --no-install-recommends ca-certificates graphviz tar wget zip
31
32 - name: Install Doxygen 1.16.1
33 shell: bash
34 run: |
35 DOXYGEN_VERSION=1.16.1
36 DOXYGEN_FILE="doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz"
37 DOXYGEN_URL="https://sourceforge.net/projects/doxygen/files/rel-${DOXYGEN_VERSION}/${DOXYGEN_FILE}/download"
38 DOXYGEN_SHA256="a56f885d37e3aae08a99f638d17bbb381224c03a878d9e2dda4f9fa4baf1d8bd"
39 wget -O "/tmp/${DOXYGEN_FILE}" "${DOXYGEN_URL}"
40 echo "${DOXYGEN_SHA256} /tmp/${DOXYGEN_FILE}" | sha256sum -c -
41 tar -xzf "/tmp/${DOXYGEN_FILE}" -C /tmp
42 sudo install -m 0755 "/tmp/doxygen-${DOXYGEN_VERSION}/bin/doxygen" /usr/local/bin/doxygen
43 doxygen --version
44
45 - name: Resolve version
46 id: version
47 shell: bash
48 env:
49 INPUT_VERSION: ${{ github.event.inputs.version }}
50 GIT_REF_TYPE: ${{ github.ref_type }}
51 GIT_REF_NAME: ${{ github.ref_name }}
52 run: |
53 value="${INPUT_VERSION:-}"
54 if [ -z "$value" ] && [ "${GIT_REF_TYPE:-}" = "tag" ]; then
55 value="${GIT_REF_NAME}"
56 fi
57 if [ -z "$value" ]; then
58 value="$(bash scripts/compute-version.sh)"
59 fi
60 value="${value#ver.}"
61 value="${value#v}"
62 echo "value=$value" >> "$GITHUB_OUTPUT"
63 echo "VERSION=$value" >> "$GITHUB_ENV"
64
65 - name: Build documentation
66 run: make doc
67
68 - name: Package documentation
69 shell: bash
70 run: |
71 test -d build/doc/doc/html
72 mkdir -p dist
73 (cd build/doc/doc && zip -r "../../../dist/opencc-${VERSION}-doc.zip" html)
74
75 - name: Upload documentation artifact
76 uses: actions/upload-artifact@v7
77 with:
78 name: opencc-doc-${{ steps.version.outputs.value }}
79 path: dist/opencc-${{ steps.version.outputs.value }}-doc.zip
80
81 - name: Upload assets to existing GitHub release
82 if: startsWith(github.ref, 'refs/tags/')
83 env:
84 GH_TOKEN: ${{ github.token }}
85 run: |
86 tag="${{ github.ref_name }}"
87 for i in $(seq 1 30); do
88 gh release view "$tag" --json isDraft > /dev/null 2>&1 && break
89 echo "Waiting for release $tag to be created ($i/30)..."
90 sleep 10
91 done
92 gh release upload "$tag" \
93 "dist/opencc-${VERSION}-doc.zip" \
94 --clobber