Skip to content

Deploy to GitHub Packages Registry #2

Deploy to GitHub Packages Registry

Deploy to GitHub Packages Registry #2

Workflow file for this run

name: CI (main)
on:
push:
branches: [ "main" ]
paths-ignore:
- "**/*.md"
- "**/*.gitignore"
- "**/*.gitattributes"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
name: Build
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
DOTNET_ADD_GLOBAL_TOOLS_TO_PATH: false
DOTNET_MULTILEVEL_LOOKUP: 0
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: true
steps:
- uses: actions/checkout@v4
- name: Install .NET SDK
uses: actions/setup-dotnet@v4
with:
global-json-file: "./global.json"
- name: Install Aspire workload
run: dotnet workload install aspire
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release -p:SourceRevisionId=$GITHUB_SHA
- name: Pack (ci)
run: dotnet pack --configuration Release --output ./artifacts/ci --verbosity normal -p:SourceRevisionId=$GITHUB_SHA
- name: Upload artifacts (packages)
uses: actions/upload-artifact@v4
with:
name: nupkg
path: ./artifacts/**/*.nupkg
retention-days: 5
deploy:
name: Deploy
needs: build
runs-on: ubuntu-latest
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
DOTNET_ADD_GLOBAL_TOOLS_TO_PATH: false
DOTNET_MULTILEVEL_LOOKUP: 0
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: true
permissions:
packages: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
- name: Add GitHub Package Repository source
run: dotnet nuget add source --username fredimachado --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/fredimachado/index.json"
- name: Push to GitHub Packages
run: dotnet nuget push **/ci/*.nupkg --source "github" --api-key ${{ secrets.GITHUB_TOKEN }}