Compile Resonite Data #266
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Compile Resonite Data | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
push: | |
workflow_dispatch: | |
jobs: | |
compile-resonite-data: | |
name: "Compile Resonite Data" | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it. | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Lets get SteamCMD downloaded. | |
- name: Install SteamCMD | |
# Check for a Resonite cache | |
uses: CyberAndrii/setup-steamcmd@v1.2.0 | |
# And now to download Resonite. | |
- name: Install Resonite | |
# Check for a Resonite cache | |
run: steamcmd +force_install_dir $HOME/Steam/steamapps/common/Resonite +login ${{ secrets.PASSCODE }} +app_update 2519830 validate +quit | |
- name: Gather Version Information | |
id: getversion | |
run: | | |
# Goto the Resonite directory. | |
cd $HOME/Steam/steamapps/common/Resonite | |
# Make some envrionment variables for our version IDs. | |
echo "resonite_cached_version=$(cat $GITHUB_WORKSPACE/data/Build.version)" >> $GITHUB_ENV | |
echo "resonite_latest_version=$(cat Build.version)" >> $GITHUB_ENV | |
# Put our versions into the summary. | |
- name: Print Version Information | |
run: | | |
echo "Cached Version: $resonite_cached_version" >> $GITHUB_STEP_SUMMARY | |
echo "Latest Version: $resonite_latest_version" >> $GITHUB_STEP_SUMMARY | |
# Check if the version is different and if it is, we will update the data. | |
- name: Check if update is required | |
id: check_version | |
run: | | |
if [ "$resonite_cached_version" != "$resonite_latest_version" ]; then | |
should_update="true" | |
else | |
should_update="false" | |
fi | |
echo "should_update=$should_update" >> "$GITHUB_ENV" | |
echo "should_update=$should_update" >> "$GITHUB_OUTPUT" | |
echo "::debug::should_update=$should_update" | |
if [ "$should_update" = "true" ]; then | |
echo 'Requires an update!' >> "$GITHUB_STEP_SUMMARY" | |
fi | |
echo "::debug::GITHUB_ENV contents: $(cat "${GITHUB_ENV}")" | |
echo "::debug::GITHUB_STEP_SUMMARY contents: $(cat "${GITHUB_STEP_SUMMARY}")" | |
env: | |
# I am REALLY making sure it's set :))))) | |
should_update: ${{ steps.check_version.outputs.should_update }} | |
# Builds Resonite with our custom cs file and runs to generate our output files. | |
- name: Build FrooxEngineTypeParser | |
if: steps.check_version.outputs.should_update == 'true' | |
run: | | |
set -e | |
cd $GITHUB_WORKSPACE | |
dotnet build -c Release | |
- name: Run FrooxEngineTypeParser and prepare the outputs | |
if: steps.check_version.outputs.should_update == 'true' | |
run: | | |
set -e | |
$GITHUB_WORKSPACE/bin/Release/net8.0/FrooxEngineTypeParser | |
# Moves the Version file to github repo as that isn't handled by the script. | |
mv $HOME/Steam/steamapps/common/Resonite/Build.version $GITHUB_WORKSPACE/data | |
# Commits the changes to the repo. | |
- name: Apply changes | |
if: steps.check_version.outputs.should_update == 'true' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# Set up git | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git pull origin ${{ github.ref_name }} | |
git add data/ComponentList.txt | |
git add data/ProtoFluxList.txt | |
git add data/MethodsList.txt | |
git add data/Build.version | |
# Commit Time! | |
git commit -m "$resonite_latest_version" || true | |
git push origin ${{ github.ref_name }} |