Skip to content

2.1.0 (#53)

2.1.0 (#53) #15

name: GithubActionsRelease
############################################################################################################
# All of thes jobs runs commands only on a tag push in the Material-Blazor\Material.Blazor repository
# The publishing actions in forked repositories were handled by the WIP workflow
# An 'ExitWorkflow' action is sorely needed
############################################################################################################
# NUGET_API_KEY is valid through 9/11/2021
############################################################################################################
on:
push:
tags:
- '*' # Push events to matching *, i.e. 1.0, 20.15.10
env:
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
outputCSFB: ${{github.workspace}}\siteCSFB
projectCSFB: 'CompressedStaticFiles.AspNet/CompressedStaticFiles.AspNet.csproj'
projectTest: 'CompressedStaticFiles.AspNet.Test/CompressedStaticFiles.AspNet.Test.csproj'
jobs:
############################################################################################################
# These jobs are used to gate actions. By creating these jobs we don't need to proliferate the repo checks
############################################################################################################
is-on-fork:
name: Running on a fork?
runs-on: ubuntu-latest
if: github.repository != 'Material-Blazor/CompressedStaticFiles.AspNet'
steps:
- name: Nothing to see here
run: echo ""
is-on-material-blazor:
name: Running on Material-Blazor/CompressedStaticFiles.AspNet?
runs-on: ubuntu-latest
if: github.repository == 'Material-Blazor/CompressedStaticFiles.AspNet'
steps:
- name: Nothing to see here
run: echo ""
############################################################################################################
# Build package and deploy
############################################################################################################
build-and-deploy-package:
name: Build nuget package & deploy to nuget
needs: [is-on-material-blazor]
runs-on: windows-latest
steps:
- name: Checkout repository under $GITHUB_WORKSPACE so the job can access it 🛎️
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Use dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
- name: Get the version
run: echo "version=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
shell: bash
- name: Build CompressedStaticFiles.AspNetCore 🔧
run: dotnet build ${{env.projectCSFB}} --configuration ${{env.buildConfiguration}} -p:Version=${{env.version}}
- name: Generate the NuGet package 🔧
run: dotnet pack ${{env.projectCSFB}} --no-build --configuration ${{env.buildConfiguration}} --output ${{env.outputCSFB}} -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg -p:Version=${{env.version}}
- name: Display CompressedStaticFiles.AspNetCore package output Ꙫ
run: dir ${{env.outputCSFB}}
- name: Upload Package 🚀
run: dotnet nuget push ${{env.outputCSFB}}\*.nupkg -k ${{secrets.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json
############################################################################################################
# Create release
############################################################################################################
create-release:
name: Create release
needs: [build-and-deploy-package, is-on-material-blazor]
runs-on: windows-latest
steps:
- name: Get the version
run: echo "version=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
shell: bash
- name: Create Release
uses: ncipollo/release-action@v1
with:
name: Release ${{env.version}}
tag: ${{env.version}}