Skip to content

Manual Workflow - Publish Package #33

Manual Workflow - Publish Package

Manual Workflow - Publish Package #33

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: 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: Get version
run: |
tag_name=$(grep '<Version>' < ./ComtradeHandler.Core/ComtradeHandler.Core.csproj | sed 's/.*<Version>\(.*\)<\/Version>/\1/')
echo "TAG_NAME=$tag_name" >> "$GITHUB_ENV"
echo "echo_TAG_NAME = $tag_name"
id: version
# - name: Create Tag
# uses: rickstaa/[email protected]
# with:
# tag: v${{ steps.version.outputs.TAG_NAME }}
- 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=v$TAG_NAME
echo "echo_TAG = $tag"
release_name="ComtradeHandler-$tag"
echo "echo_RELEASE_NAME = $release_name"
echo "RELEASE_NAME=$release_name" >> "$GITHUB_ENV"
artifact_name=${release_name}.zip
echo "echo_Artifact_Name = $artifact_name"
echo "ARTIFACT_NAME=$artifact_name" >> "$GITHUB_ENV"
dotnet publish ./ComtradeHandler.Core/ComtradeHandler.Core.csproj -c Release -o "$release_name"
7z a -tzip "$artifact_name" "./${release_name}/*"
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: $ARTIFACT_NAME
path: $ARTIFACT_NAME
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}