Skip to content

Docker Publish from Develop #14

Docker Publish from Develop

Docker Publish from Develop #14

name: Docker Publish from Develop
on:
workflow_dispatch:
inputs:
run_tests:
description: 'Run Tests'
required: false
default: true
type: boolean
version:
description: 'Release Version'
required: true
type: string
jobs:
build:
name: Build, Test & Publish to Docker Hub
runs-on: ubuntu-latest
permissions:
checks: write
contents: read
env:
BUILD_CONFIG: 'Release'
steps:
- uses: actions/checkout@v3
with:
ref: 'develop'
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Setup NuGet
uses: nuget/setup-nuget@v1
with:
nuget-version: 'latest'
- name: Docker Compose Setup
if: ${{ github.event.inputs.run_tests == 'true' }}
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=${{ github.event.inputs.version }} --no-restore
- name: Test
if: ${{ github.event.inputs.run_tests == 'true' }}
run: dotnet test --no-build --configuration $BUILD_CONFIG --logger "trx" --verbosity d --results-directory "./"
- name: Upload test results
if: ${{ github.event.inputs.run_tests == 'true' }} && (success() || failure())
uses: actions/upload-artifact@v3
with:
name: test-results
path: ./*.trx
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_API_USERNAME }}
password: ${{ secrets.DOCKER_API_KEY }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build & Push Docker image
uses: docker/build-push-action@v3
with:
context: ./
file: src/OnlineSales/Dockerfile
push: true
tags: wavepoint/onlinesales:develop