Skip to content

Merge pull request #74 from OctopusSamples/user-story-5649 #96

Merge pull request #74 from OctopusSamples/user-story-5649

Merge pull request #74 from OctopusSamples/user-story-5649 #96

Workflow file for this run

name: CI - Nuget Packages
on:
push:
branches: [ "main" ]
workflow_dispatch:
jobs:
build:
name: Build & Push .NET packages
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version-generator.outputs.version }}
steps:
- uses: actions/checkout@v2
- name: Set Version Number
id: version-generator
run: echo "version=$(date +'%Y.%m.%d').$GITHUB_RUN_NUMBER" >> $GITHUB_OUTPUT
- name: Setup .NET 6
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.406'
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- 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/install-octopus-cli-action@v1.1.6
with:
version: latest
- name: Package OctoPetShopDatabase
run: |
octo pack --id="OctoPetShop.Database" --format="Zip" --version="${{ steps.version-generator.outputs.version }}" --basePath="$GITHUB_WORKSPACE/artifacts/OctopusSamples.OctoPetShop.Database" --outFolder="$GITHUB_WORKSPACE/artifacts"
- name: Package OctoPetShopWeb
run: |
octo pack --id="OctoPetShop.Web" --format="Zip" --version="${{ steps.version-generator.outputs.version }}" --basePath="$GITHUB_WORKSPACE/artifacts/OctopusSamples.OctoPetShop.Web" --outFolder="$GITHUB_WORKSPACE/artifacts"
- name: Package OctoPetShopProductService
run: |
octo pack --id="OctoPetShop.ProductService" --format="Zip" --version="${{ steps.version-generator.outputs.version }}" --basePath="$GITHUB_WORKSPACE/artifacts/OctopusSamples.OctoPetShop.ProductService" --outFolder="$GITHUB_WORKSPACE/artifacts"
- name: Package OctoPetShopShoppingCartService
run: |
octo pack --id="OctoPetShop.ShoppingCartService" --format="Zip" --version="${{ steps.version-generator.outputs.version }}" --basePath="$GITHUB_WORKSPACE/artifacts/OctopusSamples.OctoPetshop.ShoppingCartService" --outFolder="$GITHUB_WORKSPACE/artifacts"
- name: Push OctoPetShop Packages
uses: OctopusDeploy/push-package-action@v1.1.1
with:
api_key: ${{ secrets.OCTOPUS_API_KEY }}
server: ${{ secrets.OCTOPUS_SERVER_URL }}
space: ${{ secrets.OCTOPUS_SPACE_NAME }}
packages: |
artifacts/OctoPetShop.Database.${{ steps.version-generator.outputs.version }}.zip
artifacts/OctoPetShop.Web.${{ steps.version-generator.outputs.version }}.zip
artifacts/OctoPetShop.ProductService.${{ steps.version-generator.outputs.version }}.zip
artifacts/OctoPetShop.ShoppingCartService.${{ steps.version-generator.outputs.version }}.zip
Push-build-information:
name: Push Build Information to Octopus πŸ™
needs: build
runs-on: ubuntu-latest
env:
OCTOPUS_URL: ${{ secrets.OCTOPUS_URL }}
OCTOPUS_API_KEY: ${{ secrets.OCTOPUS_API_KEY }}
OCTOPUS_SPACE: ${{ secrets.OCTOPUS_SPACE }}
steps:
- uses: OctopusDeploy/push-build-information-action@v3
name: Push Build Information
with:
version: ${{ needs.build.outputs.version }}
packages: |
OctoPetShop.Database
OctoPetShop.Web
OctoPetShop.ProductService
OctoPetShop.ShoppingCartService
Create-Octopus-Release:
name: Create Octopus Release πŸ™
needs: [build, Push-build-information]
runs-on: ubuntu-latest
env:
OCTOPUS_URL: ${{ secrets.OCTOPUS_URL }}
OCTOPUS_API_KEY: ${{ secrets.OCTOPUS_API_KEY }}
OCTOPUS_SPACE: ${{ secrets.OCTOPUS_SPACE }}
steps:
- uses: OctopusDeploy/create-release-action@v3
id: "create-release"
with:
project: "OctoPetShop - IIS"
outputs:
release_number: ${{ steps.create-release.outputs.release_number }}
Create-Octopus-Release-Tenant:
if: false
name: Create Octopus Release - Tenant πŸ™
needs: [build, Push-build-information]
runs-on: ubuntu-latest
env:
OCTOPUS_URL: ${{ secrets.OCTOPUS_URL }}
OCTOPUS_API_KEY: ${{ secrets.OCTOPUS_API_KEY }}
OCTOPUS_SPACE: ${{ secrets.OCTOPUS_SPACE }}
steps:
- uses: OctopusDeploy/create-release-action@v3
id: "create-release"
with:
project: "Point of Sale"
outputs:
release_number: ${{ steps.create-release.outputs.release_number }}