Update build.yml #56
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: Build | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set Environment Variables | |
run: | | |
echo "REPO_NAME=$(basename $GITHUB_REPOSITORY)" >> $GITHUB_ENV | |
echo "REFASM_TAG=SDV1.6.8-SMAPI4.0.8" >> $GITHUB_ENV | |
# Setup GamePath | |
echo "GamePath=$GITHUB_WORKSPACE/GamePath" >> "$GITHUB_ENV" | |
echo "<Project><PropertyGroup><GamePath>$GITHUB_WORKSPACE/GamePath</GamePath></PropertyGroup></Project>" > "$HOME/stardewvalley.targets" | |
- name: Checkout Submodule | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Cache NuGet | |
id: cache-nuget | |
uses: actions/[email protected] | |
with: | |
path: | | |
~/.nuget/packages | |
${{ github.workspace }}/obj | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} | |
- name: Resore Reference Assemblies | |
id: cache-refasm | |
uses: actions/[email protected] | |
with: | |
path: GamePath | |
key: ${{ runner.os }}-mod-reference-${{ env.REFASM_TAG }} | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 6.0.X | |
- name: Setup game and SMAPI | |
if: steps.cache-refasm.outputs.cache-hit != 'true' | |
uses: actions/checkout@v4 | |
with: | |
repository: Smoked-Fish/mod-reference-assemblies | |
fetch-tags: true | |
ref: refs/tags/${{ env.REFASM_TAG }} | |
path: GamePath | |
- name: Restore dependencies | |
if: steps.cache-nuget.outputs.cache-hit != 'true' | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore --configuration Release | |
- name: Fetch version | |
run: | | |
echo "MOD_VERSION=$(cat $GITHUB_WORKSPACE/bin/Release/version.txt)" >> $GITHUB_ENV | |
- name: Unzip mod | |
run: | | |
MOD_ZIP_PATH="${{ github.workspace }}/bin/Release/${{ env.REPO_NAME }} ${{ env.MOD_VERSION }}.zip" | |
unzip "$MOD_ZIP_PATH" -d Mod | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.REPO_NAME }} ${{ env.MOD_VERSION }} | |
path: Mod |