Skip to content

Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows #9

Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows

Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows #9

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: publish
on:
# Allow running the workflow manually from the GitHub UI
workflow_dispatch:
push:
# Run the workflow when pushing to the main branch
branches:
- 'main'
pull_request:
# Run the workflow for all pull requests
branches:
- '*'
release:
# Run the workflow when a new GitHub release is published
types:
- published
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
NugetDirectory: ${{github.workspace}}/nuget
defaults:
run:
shell: pwsh
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Get all history to allow automatic versioning using MinVer
- name: Setup .NET
uses: actions/setup-dotnet@v3
- run: |
dotnet build AzureGems.sln -c Release
dotnet pack AzureGems.sln -c Release --no-build --property:PackageOutputPath=${{ env.NugetDirectory }}
- uses: actions/upload-artifact@v3
with:
name: nuget
if-no-files-found: error
retention-days: 7
path: ${{ env.NugetDirectory }}/*.nupkg
deploy:
# Publish only when creating a GitHub Release
# https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository
if: github.event_name == 'release'
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/[email protected]
with:
name: nuget
path: ${{ env.NugetDirectory }}
- name: Setup .NET
uses: actions/setup-dotnet@v3
- name: Publish NuGet package
run: |
foreach($file in (Get-ChildItem "${{ env.NugetDirectory }}" -Recurse -Include *.nupkg)) {
dotnet nuget push $file --api-key "${{ secrets.NUGET_KEY }}" --source https://api.nuget.org/v3/index.json
}