Skip to content

Commit

Permalink
Add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
erri120 committed Jan 9, 2025
1 parent 886cffb commit 77fe805
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Release

on:
workflow_dispatch:
inputs:
version:
description: 'Version'
required: true

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Get version from input
id: tag_name
shell: pwsh
env:
INPUT_VERSION: ${{ github.event.inputs.version }}
run: |
$current_version = $env:INPUT_VERSION.StartsWith('v') ? $env:INPUT_VERSION.Substring(1) : $env:INPUT_VERSION
echo "current_version=$current_version" >> $env:GITHUB_OUTPUT
- uses: actions/checkout@v4

- name: Print Debug Info
run: dotnet --info

- name: Restore dependencies
run: dotnet restore

- name: Pack
# https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#packrelease
env:
DOTNET_CLI_ENABLE_PACK_RELEASE_FOR_SOLUTIONS: true
run: dotnet pack -c Release --no-restore -p:Version="${{ steps.tag_name.outputs.current_version }}" -p:RepositoryBranch=${{ github.ref_name }} -p:RepositoryCommit="${{ github.sha }}"

- name: Push to NuGet
run: dotnet nuget push **/*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json

- name: Push to GitHub Packages
run: dotnet nuget push **/*.nupkg --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/erri120/index.json

0 comments on commit 77fe805

Please sign in to comment.