-
-
Notifications
You must be signed in to change notification settings - Fork 35
91 lines (77 loc) · 2.94 KB
/
documentation.yml
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
name: Build
on:
push:
tags:
- "*"
jobs:
dependencies:
name: Build dependencies
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Check out source files
uses: actions/checkout@v4
- name: Create global variables
id: version
run: echo "version=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
build:
name: Build PDF files
runs-on: ubuntu-latest
needs: dependencies
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Check out source files
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Build document
run: |
nix run github:loophp/nix-sphinx#build -- -M latexpdf docs/ build/docs
cp build/docs/latex/loophp-collection-documentation.pdf documentation.pdf
- name: Upload build assets
uses: actions/upload-artifact@v3
with:
name: assets
path: documentation.pdf
release:
name: "Create tag/pre-release"
runs-on: ubuntu-latest
needs: [dependencies, build]
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create pre-release (${{ needs.dependencies.outputs.version }})
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.run_number }}-${{ needs.dependencies.outputs.version }}
release_name: Version ${{ github.run_number }} (${{ needs.dependencies.outputs.version }})
draft: false
prerelease: true
assets:
name: Upload release assets
runs-on: ubuntu-latest
needs: [dependencies, release]
steps:
- name: Download build assets (${{ matrix.assets.input }})
uses: actions/download-artifact@v3
with:
name: assets
path: assets
- name: Upload release assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: assets/documentation.pdf
asset_name:
loophp-collection-documentation--version-${{ github.ref_name }}--${{
needs.dependencies.outputs.version }}.pdf
asset_content_type: application/pdf