Skip to content

Bump System.Text.Json from 6.0.5 to 8.0.4 in /src/Tinify #16

Bump System.Text.Json from 6.0.5 to 8.0.4 in /src/Tinify

Bump System.Text.Json from 6.0.5 to 8.0.4 in /src/Tinify #16

Workflow file for this run

name: .NET CI/CD
on: [push, pull_request]
env:
# more info on dotnet cli environment variables here: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-environment-variables
# Disable sending usage data to Microsoft
DOTNET_CLI_TELEMETRY_OPTOUT: true
# Disable welcome message on dotnet CLI first run
DOTNET_NOLOGO: true
# Disable redundant package caching
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
jobs:
tests:
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up dotnet
uses: actions/setup-dotnet@v2
with:
dotnet-version: |
3.1.x
5.0.x
6.0.x
- uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Install dependencies
run: |
dotnet restore
- name: Build
run: |
dotnet build --configuration Release --version-suffix "$GITHUB_RUN_ID-prerelease" --no-restore
- name: Run tests on mac and linux
if: ${{ !startsWith(matrix.os, 'windows') }}
env:
TINIFY_KEY: ${{ secrets.TINIFY_KEY }}
run: |
dotnet test --configuration Release --no-build --verbosity normal --framework netcoreapp3.1 test/Tinify.Tests
dotnet test --configuration Release --no-build --verbosity normal --framework net5.0 test/Tinify.Tests
dotnet test --configuration Release --no-build --verbosity normal --framework net6.0 test/Tinify.Tests
- name: Run tests on windows
if: startsWith(matrix.os, 'windows')
env:
TINIFY_KEY: ${{ secrets.TINIFY_KEY }}
run: |
dotnet test --configuration Release --no-build --verbosity normal --framework net6.0 test/Tinify.Tests
integrationTests:
if: github.event_name == 'push'
runs-on: ${{ matrix.os }}
needs:
- "tests"
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up dotnet
uses: actions/setup-dotnet@v2
with:
dotnet-version: |
3.1.x
6.0.x
- uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Install dependencies
run: |
dotnet restore
- name: Build
run: |
dotnet build --configuration Release --version-suffix "$GITHUB_RUN_ID-prerelease" --no-restore
- name: Run tests on mac and linux
if: ${{ !startsWith(matrix.os, 'windows') }}
env:
TINIFY_KEY: ${{ secrets.TINIFY_KEY }}
run: |
dotnet test --configuration Release --no-build --verbosity normal --framework netcoreapp3.1 test/Tinify.Tests.Integration
dotnet test --configuration Release --no-build --verbosity normal --framework net6.0 test/Tinify.Tests.Integration
- name: Run tests on windows
if: startsWith(matrix.os, 'windows')
env:
TINIFY_KEY: ${{ secrets.TINIFY_KEY }}
run: |
dotnet test --configuration Release --no-build --verbosity normal --framework net6.0 test/Tinify.Tests.Integration
publish:
if: |
github.repository == 'tinify/tinify-net' &&
startsWith(github.ref, 'refs/tags') &&
github.event_name == 'push'
needs:
- "tests"
- "integrationTests"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up dotnet
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x
- name: Check if properly tagged
run: |
PACKAGE_VERSION="$(sed 's/\s*<VersionPrefix>\(.*\)<\/VersionPrefix>/\1/p' -n < src/Tinify/Tinify.csproj | tr -d '\n\r')";
CURRENT_TAG="${GITHUB_REF#refs/*/}";
if [[ "${PACKAGE_VERSION}" != "${CURRENT_TAG}" ]]; then
>&2 echo "Tag mismatch"
>&2 echo "Version in tinify/version.py (${PACKAGE_VERSION}) does not match the current tag=${CURRENT_TAG}"
>&2 echo "Skipping deploy"
exit 1;
fi
- name: Create Release NuGet package
run: |
CURRENT_TAG="${GITHUB_REF#refs/*/}";
echo "Clean Version: ${CURRENT_TAG}"
dotnet pack src/Tinify/Tinify.csproj -v normal -c Release --include-symbols --include-source -p:PackageVersion="${CURRENT_TAG}" -o .
- name: Push to Nuget
run: |
dotnet nuget push *.nupkg --skip-duplicate -s https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_API_KEY}}