Skip to content

deps: Bump the maui group with 1 update #10

deps: Bump the maui group with 1 update

deps: Bump the maui group with 1 update #10

Workflow file for this run

# EightBot.Maui.Badger - Build and Publish Workflow
name: Build and Publish
on:
push:
branches: [main, develop]
tags: ['v*']
pull_request:
branches: [main, develop]
env:
DOTNET_VERSION: '9.0.x'
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
LIBRARY_PROJECT: src/EightBot.Maui.Badger/EightBot.Maui.Badger/EightBot.Maui.Badger.csproj
jobs:
# =============================================================================
# Build Library (All Platforms on macOS)
# =============================================================================
build:
name: Build Library
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Install MAUI Workloads
run: dotnet workload install maui
- name: Restore
run: dotnet restore ${{ env.LIBRARY_PROJECT }}
- name: Build Library (All Platforms)
run: dotnet build ${{ env.LIBRARY_PROJECT }} -c Release --no-restore
# =============================================================================
# Pack NuGet Package
# =============================================================================
pack:
name: Pack NuGet
needs: build
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Install MAUI Workloads
run: dotnet workload install maui
- name: Determine Version
id: version
run: |
if [[ $GITHUB_REF == refs/tags/v* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
elif [[ $GITHUB_REF == refs/heads/main ]]; then
VERSION="1.0.0-rc.${{ github.run_number }}"
else
VERSION="0.0.1-preview.${{ github.run_number }}"
fi
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "Package Version: $VERSION"
- name: Restore
run: dotnet restore ${{ env.LIBRARY_PROJECT }}
- name: Pack NuGet
run: |
dotnet pack ${{ env.LIBRARY_PROJECT }} \
-c Release \
-o ./artifacts \
-p:PackageVersion=${{ steps.version.outputs.VERSION }} \
-p:ContinuousIntegrationBuild=true \
--no-restore
- name: Upload NuGet Artifact
uses: actions/upload-artifact@v4
with:
name: nuget-package
path: ./artifacts/*.nupkg
retention-days: 30
- name: Upload Symbols Artifact
uses: actions/upload-artifact@v4
with:
name: nuget-symbols
path: ./artifacts/*.snupkg
retention-days: 30
if-no-files-found: ignore
# =============================================================================
# Publish to GitHub Packages
# =============================================================================
publish-github:
name: Publish to GitHub Packages
needs: pack
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/v'))
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Download NuGet Artifact
uses: actions/download-artifact@v4
with:
name: nuget-package
path: ./artifacts
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Add GitHub Packages Source
run: |
dotnet nuget add source \
--username ${{ github.actor }} \
--password ${{ secrets.GITHUB_TOKEN }} \
--store-password-in-clear-text \
--name github \
"https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
- name: Push to GitHub Packages
run: |
dotnet nuget push ./artifacts/*.nupkg \
--source github \
--skip-duplicate
# =============================================================================
# Publish to NuGet.org (Release Tags Only)
# =============================================================================
publish-nuget:
name: Publish to NuGet.org
needs: pack
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Download NuGet Artifact
uses: actions/download-artifact@v4
with:
name: nuget-package
path: ./artifacts
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Push to NuGet.org
run: |
dotnet nuget push ./artifacts/*.nupkg \
--source https://api.nuget.org/v3/index.json \
--api-key ${{ secrets.EIGHTBOT_NUGET_APIKEY }} \
--skip-duplicate
# =============================================================================
# Create GitHub Release
# =============================================================================
release:
name: Create GitHub Release
needs: [publish-github, publish-nuget]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download NuGet Artifact
uses: actions/download-artifact@v4
with:
name: nuget-package
path: ./artifacts
- name: Download Symbols Artifact
uses: actions/download-artifact@v4
with:
name: nuget-symbols
path: ./artifacts
continue-on-error: true
- name: Extract Version
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: v${{ steps.version.outputs.VERSION }}
tag_name: ${{ github.ref_name }}
files: |
./artifacts/*.nupkg
./artifacts/*.snupkg
generate_release_notes: true
draft: false
prerelease: ${{ contains(github.ref, '-') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}