Skip to content

Commit f69e1e6

Browse files
committed
Add nightly.yml workflow
1 parent 6876eff commit f69e1e6

File tree

5 files changed

+82
-46
lines changed

5 files changed

+82
-46
lines changed

.github/workflows/nightly.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Build nightly release
2+
3+
on:
4+
schedule:
5+
- cron: '0 12 * * *'
6+
workflow_dispatch:
7+
8+
jobs:
9+
update_submodules:
10+
uses: ./.github/workflows/update-submodules.yml
11+
12+
update_definitions:
13+
uses: ./.github/workflows/update-definitions.yml
14+
15+
upload:
16+
name: Upload definitions
17+
runs-on: ubuntu-22.04
18+
steps:
19+
- name: Clone definitions
20+
uses: actions/checkout@v4
21+
with:
22+
sparse-checkout: dist
23+
sparse-checkout-cone-mode: false
24+
25+
- name: Upload as artifacts
26+
uses: actions/upload-artifact@v4
27+
with:
28+
name: dfhack-lua-definitions
29+
path: dist
30+
compression-level: 9
31+
32+
33+
Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
1-
name: Build
1+
name: Test
22

33
on:
44
push:
5-
branches:
6-
- main
5+
pull_request:
76
workflow_call:
87
workflow_dispatch:
98

109
jobs:
11-
build:
12-
name: Generate Annotations
10+
test:
11+
name: Run tests
1312
runs-on: ubuntu-22.04
1413
steps:
1514
- uses: actions/checkout@v4
1615
with:
1716
submodules: true
17+
1818
- uses: ruby/setup-ruby@v1
1919
with:
2020
bundler-cache: true
21-
- run: bundle exec rake
22-
# TODO: Improve testing.
23-
continue-on-error: true
24-
- name: Build annotations
21+
22+
- name: Run Rspec
23+
run: bundle exec rake
24+
25+
- name: Generate definitions
2526
run: bundle exec rake build
27+
2628
- name: Upload artifacts
2729
uses: actions/upload-artifact@v4
2830
with:
2931
name: dfhack-lua-definitions
3032
path: dist
31-
compression-level: 9

.github/workflows/update-annotations.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Update definitions
2+
3+
on: workflow_call
4+
5+
jobs:
6+
run:
7+
name: Update definitions
8+
runs-on: ubuntu-22.04
9+
permissions:
10+
contents: write
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
submodules: true
15+
16+
- name: Generate definitions
17+
run: rake build
18+
19+
- name: Check if definitions changed
20+
id: definitions_changed
21+
run: echo "changed=$(git diff --quiet HEAD -- dist; echo $?)" >> $GITHUB_OUTPUT
22+
23+
- name: Setup git user
24+
if: ${{ steps.definitions_changed.outputs.changed == true }}
25+
run: |
26+
git config user.name github-actions
27+
git config user.email [email protected]
28+
29+
- name: Commit changes
30+
if: ${{ steps.definitions_changed.outputs.changed == true }}
31+
run: |
32+
git add dist
33+
git commit -m "Auto-update definitions"
34+
git push

.github/workflows/update-submodules.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,20 @@ jobs:
1212
- uses: actions/checkout@v4
1313
with:
1414
submodules: true
15+
1516
- name: Update submodules
1617
run: git submodule update --remote
18+
1719
- name: Check if submodules updated
1820
id: submodules_updated
1921
run: echo "changed=$(git diff --quiet HEAD -- dfhack df-structures; echo $?)" >> $GITHUB_OUTPUT
22+
2023
- name: Setup git user
2124
if: ${{ steps.submodules_updated.outputs.changed == true }}
2225
run: |
2326
git config user.name github-actions
2427
git config user.email [email protected]
28+
2529
- name: Commit changes
2630
if: ${{ steps.submodules_updated.outputs.changed == true }}
2731
run: |

0 commit comments

Comments
 (0)