v1.2.37-pre - Test #69
Workflow file for this run
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
# This workflow will build a .NET project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | |
name: .NET NuGet & Docker Publish | |
on: | |
release: | |
types: [ published ] | |
jobs: | |
build: | |
name: Build, Test & Publish to NuGet | |
runs-on: ubuntu-latest | |
permissions: | |
checks: write | |
contents: read | |
env: | |
BUILD_CONFIG: 'Release' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Extract branch name | |
shell: bash | |
run: echo "##[set-output name=value;]$(echo ${GITHUB_REF#refs/tags/v})" | |
id: branch_name | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_API_USERNAME }} | |
password: ${{ secrets.DOCKER_API_KEY }} | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
- name: Setup NuGet | |
uses: nuget/setup-nuget@v1 | |
with: | |
nuget-version: 'latest' | |
- name: docker compose -f ./docker-compose/docker-compose.tests.yml up -d | |
run: docker compose -f ./docker-compose/docker-compose.tests.yml up -d | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --configuration $BUILD_CONFIG -p:Version=${{ steps.branch_name.outputs.value }} --no-restore | |
- name: Test | |
run: dotnet test --no-build --configuration $BUILD_CONFIG --logger "trx" --verbosity d --results-directory "./" | |
- name: Upload test results | |
uses: actions/upload-artifact@v4 | |
if: success() || failure() | |
with: | |
name: test-results | |
path: ./*.trx | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build & Push Docker image with latest tag | |
uses: docker/build-push-action@v3 | |
if: ${{ !contains(steps.branch_name.outputs.value, 'pre') }} | |
with: | |
context: ./ | |
file: src/OnlineSales/Dockerfile | |
push: true | |
tags: wavepoint/onlinesales:latest, wavepoint/onlinesales:${{ steps.branch_name.outputs.value }} | |
- name: Build & Push Docker image without latest tag | |
uses: docker/build-push-action@v3 | |
if: ${{ contains(steps.branch_name.outputs.value, 'pre') }} | |
with: | |
context: ./ | |
file: src/OnlineSales/Dockerfile | |
push: true | |
tags: wavepoint/onlinesales:develop, wavepoint/onlinesales:${{ steps.branch_name.outputs.value }} | |
- name: Publish to NuGet | |
if: success() | |
run: dotnet nuget push **/*.nupkg --source 'https://api.nuget.org/v3/index.json' --api-key ${{secrets.NUGET_API_KEY}} |