Update SynoAI.csproj #47
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: | |
schedule: | |
- cron: '0 0 10 * *' # Runs on the 10th day of every month at midnight | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
packages_updated: ${{ steps.check_packages.outputs.packages_updated }} # Reference the output here | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Install dotnet-outdated | |
run: dotnet tool install --global dotnet-outdated-tool | |
- name: Update NuGet Packages | |
id: check_packages # Give this step an ID to reference its outputs | |
run: | | |
dotnet outdated --upgrade | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "Packages updated." | |
echo "packages_updated=true" # Set the output variable | |
echo "packages_updated=true" >> $GITHUB_ENV # Set environment variable | |
else | |
echo "No package updates." | |
echo "packages_updated=false" # Set the output variable | |
echo "packages_updated=false" >> $GITHUB_ENV # Set environment variable | |
fi | |
- name: Commit and Push Changes | |
run: | | |
git config --global user.name "GitHub Action" | |
git config --global user.email "[email protected]" | |
if [ "${{ env.packages_updated }}" == "true" ]; then | |
git add . | |
git commit -m "Update NuGet packages" | |
git push | |
else | |
echo "No changes to commit." | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
if: env.packages_updated == 'true' # Use environment variable for the condition | |
run: dotnet build --no-restore | |
- name: Test | |
if: env.packages_updated == 'true' # Use environment variable for the condition | |
run: dotnet test --no-build --verbosity normal |