Skip to content

Manual Workflow - Publish Package #22

Manual Workflow - Publish Package

Manual Workflow - Publish Package #22

Workflow file for this run

name: Publish Package
on: workflow_dispatch
jobs:
publish_nuget_package:
name: Publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# - name: Get version
# id: package_version
# uses: KageKirin/get-csproj-version@v0
# with:
# file: ComtradeHandler.Core/ComtradeHandler.Core.csproj
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Build
run: |
dotnet build ./ComtradeHandler.Core -c Release
- name: Create Tag
uses: rickstaa/[email protected]
env:
VERSION_TAG: $(grep '<Version>' < ./ComtradeHandler.Core/ComtradeHandler.Core.csproj | sed 's/.*<Version>\(.*\)<\/Version>/\1/')
with:
tag: v${{env.VERSION_TAG}}
- name: Pack Project
run: |
dotnet pack ./ComtradeHandler.Core -c Release --no-build
# - name: Publish to Nuget
# env:
# NUGET_API_KEY: ${{secrets.NUGET_API_KEY}}
# run: |
# dotnet nuget push ./ComtradeHandler.Core/**/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json
# - name: Publish to Github
# run: |
# dotnet nuget add source --username gabrieldelaparra --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/gabrieldelaparra/index.json"
# dotnet nuget push ./ComtradeHandler.Core/**/*.nupkg --source "github"
- name: Publish for Release
shell: bash
run: |
tag=$(grep '<Version>' < ./ComtradeHandler.Core/ComtradeHandler.Core.csproj | sed 's/.*<Version>\(.*\)<\/Version>/\1/')
release_name="ComtradeHandler-v$tag"
# Publish everything
dotnet publish ./ComtradeHandler.Core/ComtradeHandler.Core.csproj -c Release -o "$release_name"
7z a -tzip "${release_name}.zip" "./${release_name}/*"
# Delete output directory
rm -r "$release_name"
- name: Publish
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: "ComtradeHandler*"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}