.NET Core OIDC #55
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 OIDC | |
on: | |
pull_request: | |
branches: [ master ] | |
schedule: | |
- cron: "0 09 * * MON" | |
workflow_dispatch: | |
jobs: | |
build: | |
permissions: | |
id-token: write | |
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/install-octopus-cli-action@v1.1.6 | |
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: Login to Octopus Deploy | |
uses: OctopusDeploy/login@v1 | |
with: | |
server: https://samples.octopus.app | |
service_account_id: dbd740a8-8458-43e7-87ff-8763a2a5db41 | |
- name: Push OctoPetShop packages | |
uses: OctopusDeploy/push-package-action@v3 | |
with: | |
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/create-release-action@v3 | |
with: | |
space: ${{ secrets.OCTOPUSSERVER_SPACE }} | |
project: "Octo Pet Shop" | |
# Space is Target - Hybrid |