Skip to content

Nightly Build

Nightly Build #129

Workflow file for this run

name: Nightly Build
on:
schedule:
# cronjob that triggers every day at 2PM UTC
- cron: '0 14 * * *'
workflow_dispatch:
jobs:
build_nightly:
runs-on: windows-latest
name: Build Nightly
outputs:
full_sha: ${{ steps.var.outputs.full_sha }}
short_sha: ${{ steps.var.outputs.short_sha }}
steps:
- uses: actions/checkout@v4
- name: Setup MSVC environment
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64
- name: Generate CMake project
run: cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo -S. -Bbuild -G Ninja
- name: Build 64bit release DLL
run: cmake --build ./build --config RelWithDebInfo --target ReturnOfModding --
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: binary
path: |
build/version.dll
- name: Generate Build Info
id: var
run: |
echo "full_sha=$(git rev-parse HEAD)" >> $env:GITHUB_OUTPUT
echo "short_sha=$(git rev-parse --short HEAD)" >> $env:GITHUB_OUTPUT
check_date:
runs-on: ubuntu-latest
name: Check latest commit
needs: build_nightly
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v3
- id: should_run
continue-on-error: true
name: Check if latest commit date is within the previous 24 hours
if: ${{ github.event_name == 'schedule' }}
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "should_run=false" >> $GITHUB_OUTPUT
create_release:
runs-on: ubuntu-latest
name: Create Release
needs: [ check_date, build_nightly ]
if: ${{ needs.check_date.outputs.should_run != 'false' }}
steps:
- uses: actions/checkout@v3
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: binary
- name: Echo build sha256
id: build_sha
run: |
sha256sum version.dll > sha256.checksum
echo "build_sha=$(cat sha256.checksum)" >> $GITHUB_OUTPUT
cat sha256.checksum
- name: Run latest-tag
uses: EndBug/latest-tag@84c87607fcb948bcef069c9a27445e653113979f
with:
ref: nightly
- name: Nightly Release
uses: softprops/action-gh-release@v1
with:
name: Nightly [${{ needs.build_nightly.outputs.short_sha }}]
tag_name: nightly
body: |
**This release has been built by Github Actions**
[Link to build](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
Build SHA256:
```
${{ steps.build_sha.outputs.build_sha }}
```
To verify the build SHA256 during the action, click the build link, go-to "Create Release", open the Echo build sha256 step and read the sha256.
You can download the build artifacts, generate a SHA256 checksum and compare it with the below binary.
Build artifacts ARE NOT automatically the same as release assets since release assets can be modified afterwards.
Full Commit Hash:
```
${{ needs.build_nightly.outputs.full_sha }}
```
files: |
version.dll