Skip to content

Commit

Permalink
Add nightly.yml workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
vallode committed May 2, 2024
1 parent 6876eff commit f69e1e6
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 46 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build nightly release

on:
schedule:
- cron: '0 12 * * *'
workflow_dispatch:

jobs:
update_submodules:
uses: ./.github/workflows/update-submodules.yml

update_definitions:
uses: ./.github/workflows/update-definitions.yml

upload:
name: Upload definitions
runs-on: ubuntu-22.04
steps:
- name: Clone definitions
uses: actions/checkout@v4
with:
sparse-checkout: dist
sparse-checkout-cone-mode: false

- name: Upload as artifacts
uses: actions/upload-artifact@v4
with:
name: dfhack-lua-definitions
path: dist
compression-level: 9



21 changes: 11 additions & 10 deletions .github/workflows/build.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
name: Build
name: Test

on:
push:
branches:
- main
pull_request:
workflow_call:
workflow_dispatch:

jobs:
build:
name: Generate Annotations
test:
name: Run tests
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: true

- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- run: bundle exec rake
# TODO: Improve testing.
continue-on-error: true
- name: Build annotations

- name: Run Rspec
run: bundle exec rake

- name: Generate definitions
run: bundle exec rake build

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dfhack-lua-definitions
path: dist
compression-level: 9
36 changes: 0 additions & 36 deletions .github/workflows/update-annotations.yml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/update-definitions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Update definitions

on: workflow_call

jobs:
run:
name: Update definitions
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Generate definitions
run: rake build

- name: Check if definitions changed
id: definitions_changed
run: echo "changed=$(git diff --quiet HEAD -- dist; echo $?)" >> $GITHUB_OUTPUT

- name: Setup git user
if: ${{ steps.definitions_changed.outputs.changed == true }}
run: |
git config user.name github-actions
git config user.email [email protected]
- name: Commit changes
if: ${{ steps.definitions_changed.outputs.changed == true }}
run: |
git add dist
git commit -m "Auto-update definitions"
git push
4 changes: 4 additions & 0 deletions .github/workflows/update-submodules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,20 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true

- name: Update submodules
run: git submodule update --remote

- name: Check if submodules updated
id: submodules_updated
run: echo "changed=$(git diff --quiet HEAD -- dfhack df-structures; echo $?)" >> $GITHUB_OUTPUT

- name: Setup git user
if: ${{ steps.submodules_updated.outputs.changed == true }}
run: |
git config user.name github-actions
git config user.email [email protected]
- name: Commit changes
if: ${{ steps.submodules_updated.outputs.changed == true }}
run: |
Expand Down

0 comments on commit f69e1e6

Please sign in to comment.