-
Notifications
You must be signed in to change notification settings - Fork 1
152 lines (136 loc) · 4.96 KB
/
nightly.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Nightly Release
on:
# This can be used to automatically publish nightlies at UTC nighttime
schedule:
- cron: '0 3 * * *' # run at 3 AM UTC
# This can be used to allow manually triggering nightlies from the web interface
workflow_dispatch:
inputs:
release_name:
description: 'The release name for this release. If nightly specified, will overwrite the nightly release.'
type: string
required: true
default: "nightly"
version:
description: 'The version number to give to a named release. Defaults to the current date if not specified.'
type: string
required: false
default: ''
jobs:
date-check:
runs-on: ubuntu-latest
name: Check latest commit
outputs:
date: ${{ steps.current_date.outputs.date }}
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v4
- name: print latest_commit
run: echo ${{ github.sha }}
- id: should_run
continue-on-error: true
name: check latest commit is less than a day
if: ${{ github.event_name == 'schedule' }}
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "::set-output name=should_run::false"
- id: current_date
name: 'Get Current Date'
shell: bash
run: echo "date=$(date +'%Y-%m-%d-%H-%M')" >> "$GITHUB_OUTPUT"
build:
needs: date-check
if: ${{ needs.date-check.outputs.should_run != 'false' }}
runs-on: windows-latest
steps:
# Clone this repo
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: 'recursive'
# Build the modules
- name: "Build FLUF"
id: "build"
uses: "./.github/actions/build"
- name: Publish Nightly Release
id: create_release
if: ${{ !inputs.release_name || inputs.release_name == 'nightly' }}
uses: viperproject/create-nightly-release@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tag_name: 'nightly-${{ needs.date-check.outputs.date }}'
release_name: Nightly Release
body: 'This build is automatically generated from the latest commit every night (3 AM UTC). No build will be generated if no commit happens in a day.'
keep_num: 0
keep_tags: false
- name: Add build.zip to Nightly Release
uses: WebFreak001/[email protected]
id: 'publish_nightly'
if: steps.create_release.outcome == 'success'
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
release_id: ${{ steps.create_release.outputs.id }}
asset_path: ./build.zip
asset_name: FLUF Nightly.zip
asset_content_type: application/zip
max_releases: 1
- name: "Publish Named Release"
id: 'publish_named'
if: ${{ inputs.release_name && inputs.release_name != 'nightly' }}
uses: ncipollo/release-action@v1
with:
artifacts: "${{ github.workspace }}/build.zip"
name: '${{ inputs.release_name }}'
body: 'Changelog: https://github.com/TheStarport/FLUF/blob/master/CHANGELOG.md'
tag: ${{ inputs.version != '' && inputs.version || needs.date-check.outputs.date }}
- name: "Validate Successful Publish"
if: ${{ !(steps.publish_named.outcome == 'success' || steps.publish_nightly.outcome == 'success') }}
shell: bash
run: |
echo "Neither publish step was successful, reporting error."
exit 1
build_docs:
name: "Build Documentation"
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Download Doxygen'
shell: bash
run: "sudo apt install doxygen"
- uses: actions/setup-python@v5
with:
python-version: '3.13'
cache: 'pip'
- name: "Install Pip Packages"
shell: bash
run: pip install -r requirements.txt
- name: "Run Doxygen"
shell: bash
run: |
mkdir -p ${{ github.workspace }}/docs/_build/html/xml
doxygen Doxyfile
- name: "Build Sphinx Documentation"
shell: "bash"
run: |
cd docs
sphinx-build -M html . ./_build
- name: Upload static files as artifact
id: upload
uses: actions/upload-pages-artifact@v3
with:
path: ${{ github.workspace }}/docs/_build/html
deploy_docs:
name: "Deploy Documentation"
runs-on: ubuntu-latest
needs: build_docs
environment:
name: github-pages
url: ${{ steps.build_docs.outputs.page_url }}
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
steps:
- name: "Deploy Documentation to Github Pages"
id: deployment
uses: actions/deploy-pages@v4