Manual Workflow - Publish Package #36
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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${{ env.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 "${{ env.ARTIFACT_NAME }}" "./${{ env.RELEASE_NAME }}/*" | |
- name: Publish Release | |
uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "v${{ env.TAG_NAME }}" | |
prerelease: false | |
files: ${{ env.ARTIFACT_NAME }} |