.NET Core #767
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: .NET Core | |
on: | |
pull_request: | |
branches: [ master ] | |
schedule: | |
- cron: "0 09 * * *" | |
workflow_dispatch: | |
logLevel: | |
description: 'Log level' | |
required: true | |
derault: 'warning' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set Version | |
run: echo "PACKAGE_VERSION=$(date +'%Y.%m.%d').$GITHUB_RUN_NUMBER" >> $GITHUB_ENV | |
- name: Setup .NET 6 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '6.0.x' | |
- name: Install dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --configuration Release --no-restore | |
- name: Test | |
run: dotnet test --no-restore --verbosity normal | |
- name: Create artifacts folder | |
run: | | |
mkdir "$GITHUB_WORKSPACE/artifacts" | |
mkdir "$GITHUB_WORKSPACE/artifacts/OctopusSamples.OctoPetShop.Database" | |
mkdir "$GITHUB_WORKSPACE/artifacts/OctopusSamples.OctoPetShop.Web" | |
mkdir "$GITHUB_WORKSPACE/artifacts/OctopusSamples.OctoPetShop.ProductService" | |
mkdir "$GITHUB_WORKSPACE/artifacts/OctopusSamples.OctoPetShop.ShoppingCartService" | |
- name: Publish OctoPetShopDatabase | |
run: dotnet publish OctopusSamples.OctoPetShop.Database/OctopusSamples.OctoPetShop.Database.csproj --configuration Release --no-restore --output "$GITHUB_WORKSPACE/artifacts/OctopusSamples.OctoPetShop.Database" | |
- name: Publish OctoPetShopWeb | |
run: dotnet publish OctopusSamples.OctoPetShop.Web/OctopusSamples.OctoPetShop.Web.csproj --configuration Release --no-restore --output "$GITHUB_WORKSPACE/artifacts/OctopusSamples.OctoPetShop.Web" | |
- name: Publish OctoPetShopProductService | |
run: dotnet publish OctopusSamples.OctoPetShop.ProductService/OctopusSamples.OctoPetShop.ProductService.csproj --configuration Release --no-restore --output "$GITHUB_WORKSPACE/artifacts/OctopusSamples.OctoPetShop.ProductService" | |
- name: Publish OctoPetShopShoppingCartService | |
run: dotnet publish OctopusSamples.OctoPetShop.ShoppingCartService/OctopusSamples.OctoPetShop.ShoppingCartService.csproj --configuration Release --no-restore --output "$GITHUB_WORKSPACE/artifacts/OctopusSamples.OctoPetshop.ShoppingCartService" | |
- name: Install Octopus CLI | |
uses: OctopusDeploy/[email protected] | |
with: | |
version: latest | |
- name: Package OctoPetShopDatabase | |
run: | | |
octo pack --id="OctoPetShop.Database" --format="Zip" --version="$PACKAGE_VERSION" --basePath="$GITHUB_WORKSPACE/artifacts/OctopusSamples.OctoPetShop.Database" --outFolder="$GITHUB_WORKSPACE/artifacts" | |
- name: Package OctoPetShopWeb | |
run: | | |
octo pack --id="OctoPetShop.Web" --format="Zip" --version="$PACKAGE_VERSION" --basePath="$GITHUB_WORKSPACE/artifacts/OctopusSamples.OctoPetShop.Web" --outFolder="$GITHUB_WORKSPACE/artifacts" | |
- name: Package OctoPetShopProductService | |
run: | | |
octo pack --id="OctoPetShop.ProductService" --format="Zip" --version="$PACKAGE_VERSION" --basePath="$GITHUB_WORKSPACE/artifacts/OctopusSamples.OctoPetShop.ProductService" --outFolder="$GITHUB_WORKSPACE/artifacts" | |
- name: Package OctoPetShopShoppingCartService | |
run: | | |
octo pack --id="OctoPetShop.ShoppingCartService" --format="Zip" --version="$PACKAGE_VERSION" --basePath="$GITHUB_WORKSPACE/artifacts/OctopusSamples.OctoPetshop.ShoppingCartService" --outFolder="$GITHUB_WORKSPACE/artifacts" | |
- name: Push OctoPetShop packages | |
uses: OctopusDeploy/[email protected] | |
with: | |
api_key: ${{ secrets.OCTOPUSSERVERAPIKEY }} | |
server: ${{ secrets.OCTOPUSSERVERURL }} | |
packages: "artifacts/OctoPetShop.Database.${{ env.PACKAGE_VERSION }}.zip,artifacts/OctoPetShop.Web.${{ env.PACKAGE_VERSION }}.zip,artifacts/OctoPetShop.ProductService.${{ env.PACKAGE_VERSION }}.zip,artifacts/OctoPetShop.ShoppingCartService.${{ env.PACKAGE_VERSION }}.zip" | |
space: ${{ secrets.OCTOPUSSERVER_SPACE }} | |
- name: Create and deploy release | |
uses: OctopusDeploy/[email protected] | |
with: | |
api_key: ${{ secrets.OCTOPUSSERVERAPIKEY }} | |
server: ${{ secrets.OCTOPUSSERVERURL }} | |
space: ${{ secrets.OCTOPUSSERVER_SPACE }} | |
project: "Octo Pet Shop" | |
deploy_to: "Development" | |
progress: true |