Skip to content

V2.0.0/alm+gha

V2.0.0/alm+gha #2

Workflow file for this run

name: Bootstrapper Pipeline
on:
pull_request:
branches: [main]
paths-ignore:
- .github/**
- .nuget/**
- '**.md'
workflow_dispatch:
inputs:
configuration:
type: choice
description: The build configuration to use in the deploy stage.
required: true
default: Release
options:
- Debug
- Release
jobs:
build:
name: 🛠️ Build
runs-on: ubuntu-22.04
strategy:
matrix:
configuration: [Debug, Release]
framework: [net8.0, net6.0]
outputs:
version: ${{ steps.minver-calculate.outputs.version }}
steps:
- name: Checkout
uses: codebeltnet/git-checkout@v1
- name: Install .NET
uses: codebeltnet/install-dotnet@v1
with:
includePreview: true
- name: Install MinVer
uses: codebeltnet/dotnet-tool-install-minver@v1
- id: minver-calculate
name: Calculate Version
uses: codebeltnet/minver-calculate@v2
- name: Download bootstrapper.snk file
uses: codebeltnet/gcp-download-file@v1
with:
serviceAccountKey: ${{ secrets.GCP_TOKEN }}
bucketName: ${{ secrets.GCP_BUCKETNAME }}
objectName: bootstrapper.snk
- name: Restore Dependencies
uses: codebeltnet/dotnet-restore@v2
- name: Build for ${{ matrix.framework }} (${{ matrix.configuration }})
uses: codebeltnet/dotnet-build@v2
with:
configuration: ${{ matrix.configuration }}
framework: ${{ matrix.framework }}
pack:
name: 📦 Pack
runs-on: ubuntu-22.04
strategy:
matrix:
configuration: [Debug, Release]
needs: [build]
steps:
- name: Install .NET
uses: codebeltnet/install-dotnet@v1
with:
includePreview: true
- name: Pack for ${{ matrix.configuration }}
uses: codebeltnet/dotnet-pack@v2
with:
configuration: ${{ matrix.configuration }}
uploadPackedArtifact: true
version: ${{ needs.build.outputs.version }}
sonarcloud:
name: 🔬 Code Quality Analysis
needs: [build]
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: codebeltnet/git-checkout@v1
- name: Install .NET
uses: codebeltnet/install-dotnet@v1
with:
includePreview: true
- name: Install .NET Tool - Sonar Scanner
uses: codebeltnet/dotnet-tool-install-sonarscanner@v1
- name: Restore Dependencies
uses: codebeltnet/dotnet-restore@v2
- name: Run SonarCloud Analysis
uses: codebeltnet/sonarcloud-scan@v1
with:
token: ${{ secrets.SONAR_TOKEN }}
organization: geekle
projectKey: bootstrapper
version: ${{ needs.build.outputs.version }}
- name: Build
uses: codebeltnet/dotnet-build@v2
with:
buildSwitches: -p:SkipSignAssembly=true
uploadBuildArtifact: false
- name: Finalize SonarCloud Analysis
uses: codebeltnet/sonarcloud-scan-finalize@v1
with:
token: ${{ secrets.SONAR_TOKEN }}
codeql:
name: 🛡️ Security Analysis
needs: [build]
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: codebeltnet/git-checkout@v1
- name: Install .NET
uses: codebeltnet/install-dotnet@v1
with:
includePreview: true
- name: Restore Dependencies
uses: codebeltnet/dotnet-restore@v2
- name: Prepare CodeQL SAST Analysis
uses: codebeltnet/codeql-scan@v1
- name: Build
uses: codebeltnet/dotnet-build@v2
with:
buildSwitches: -p:SkipSignAssembly=true
uploadBuildArtifact: false
- name: Finalize CodeQL SAST Analysis
uses: codebeltnet/codeql-scan-finalize@v1
deploy:
if: github.event_name != 'pull_request'
name: 🚀 Deploy v${{ needs.build.outputs.version }}
runs-on: ubuntu-22.04
needs: [build,pack,sonarcloud,codeql]
environment: Production
steps:
- uses: codebeltnet/nuget-push@v1
with:
token: ${{ secrets.NUGET_TOKEN }}
configuration: ${{ inputs.configuration == '' && 'Release' || inputs.configuration }}