Skip to content

Nightly Build

Nightly Build #4

Workflow file for this run

name: Nightly Build
on:
workflow_dispatch:
inputs:
version_number:
description: 'Version Number'
required: true
type: string
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 -D FINAL=YES -S. -Bbuild -G Ninja
- name: Prepare 64bit release DLL
shell: bash
run: |
set -x
namespace="Hell2Modding"
mod_name="Hell2Modding"
# Get latest version number from thunderstore
#version_number=$(curl --compressed -s "https://thunderstore.io/c/risk-of-rain-returns/api/v1/package/" | jq --arg package_name "$namespace-$mod_name" '.[]? | select(.full_name|startswith($package_name)) | .versions[0]?.version_number' || true)
version_number=$(echo ${{inputs.version_number}})
# Remove quotes from output
#version_number=$(echo "$version_number" | tr -d '"')
# Increment the patch version number
#version_number=$(echo $version_number | awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{$NF=sprintf("%0*d", length($NF), ($NF+1)); print}')
# For the FILEVERSION we want a , format
version_number_comma=$(echo $version_number | tr . ,)
cd src
sed -i 's/FILEVERSION .*/FILEVERSION '"$version_number_comma"'/' resources.rc
sed -i 's/"ProductVersion", *"[^"]*"/"ProductVersion", "'"$version_number"'"/g' resources.rc
cd ..
- name: Build 64bit release DLL
run: |
cmake --build ./build --config RelWithDebInfo --target Hell2Modding --
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: binary
path: |
build/d3d12.dll
build/d3d12.pdb
- 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 d3d12.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: |
d3d12.dll
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Setup TCLI
run: dotnet tool install --global tcli
- name: Thunderstore Release
run: |
set -x
namespace="Hell2Modding"
mod_name="Hell2Modding"
# Get latest version number from thunderstore
#version_number=$(curl --compressed -s "https://thunderstore.io/c/risk-of-rain-returns/api/v1/package/" | jq --arg package_name "$namespace-$mod_name" '.[]? | select(.full_name|startswith($package_name)) | .versions[0]?.version_number' || true)
# Remove quotes from output
#version_number=$(echo "$version_number" | tr -d '"')
# Increment the patch version number
#version_number=$(echo $version_number | awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{$NF=sprintf("%0*d", length($NF), ($NF+1)); print}')
#cd thunderstore
#sed -i 's/versionNumber = ".*"/versionNumber = "'"$version_number"'"/' thunderstore.toml
#tcli publish --token ${{ secrets.TCLI_AUTH_TOKEN }}