Skip to content

Automated Dependency Updates #15

Automated Dependency Updates

Automated Dependency Updates #15

name: Automated Dependency Updates
on:
schedule:
- cron: '0 0 * * 0'
jobs:
dependencies:
name: Update Dependencies
runs-on: ubuntu-latest
strategy:
matrix:
configuration: [ Release ]
dotnet-version: [ 'netcoreapp3.1', 'net5.0', 'net6.0', 'net7.0', 'net8.0' ]
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: store cache packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: |
${{ runner.os }}-${{ github.workflow }}-${{ matrix.configuration }}-${{ matrix.dotnet-version }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-${{ github.workflow }}-${{ matrix.configuration }}-${{ matrix.dotnet-version }}-nuget-${{ hashFiles('**/packages.lock.json') }}
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
3.1.x
5.0.x
6.0.x
7.0.x
8.0.x
- name: Tools
id: tools
run: |
dotnet tool restore
- name: Update
id: update
run: |
OUTPUT=$(dotnet tool run dotnet-outdated)
if [[ $OUTPUT =~ "No outdated dependencies were detected" ]]; then
echo "::set-output name=updated::false"
else
dotnet tool run dotnet-outdated -u
echo "::set-output name=updated::true"
fi
shell: bash
- name: Build
run: dotnet build --configuration ${{ matrix.configuration }} --no-restore
- name: Test
id: test
if: ${{ steps.update.outputs.updated == 'true' }}
run: dotnet test --no-restore --verbosity minimal --configuration ${{ matrix.configuration }} -f ${{ matrix.dotnet-version }}
# - name: Push
# id: push
# if: ${{ steps.update.outputs.updated == 'true' }}
# uses: stefanzweifel/git-auto-commit-action@v4
# with:
# create_branch: true
# branch: dependencies-update
# commit_author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
# commit_user_name: github-actions[bot]
# commit_user_email: 41898282+github-actions[bot]@users.noreply.github.com
# commit_message: Automated Dependency Updates