Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deploy-nuget-package.yml #28

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions .github/workflows/deploy-nuget-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,38 @@ jobs:
runs-on: ubuntu-latest
env:
VERSION: 1.0.0
ASSEMBLY_VERSION: 1.0.0.0
outputs:
VERSION: ${{ steps.output-version.outputs.VERSION }}
ASSEMBLY_VERSION: ${{ steps.output-version.outputs.ASSEMBLY_VERSION }}
steps:
- name: Set tag from input
if: ${{ github.event.inputs.version != '' }}
env:
TAG: ${{ github.event.inputs.version }}
run: echo "VERSION=${TAG#v}" >> $GITHUB_ENV
run: |
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
# Extract main version and prerelease number
MAIN_VERSION=$(echo "${TAG#v}" | cut -d'-' -f1)
PRERELEASE_NUM=$(echo "${TAG#v}" | grep -oP '(?<=-.*\.)\d+$' || echo "0")
echo "ASSEMBLY_VERSION=${MAIN_VERSION}.${PRERELEASE_NUM}" >> $GITHUB_ENV

- name: Set version variable from tag
if: ${{ github.ref_type == 'tag' }}
env:
TAG: ${{ github.ref_name }}
run: echo "VERSION=${TAG#v}" >> $GITHUB_ENV
run: |
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
# Extract main version and prerelease number
MAIN_VERSION=$(echo "${TAG#v}" | cut -d'-' -f1)
PRERELEASE_NUM=$(echo "${TAG#v}" | grep -oP '(?<=-.*\.)\d+$' || echo "0")
echo "ASSEMBLY_VERSION=${MAIN_VERSION}.${PRERELEASE_NUM}" >> $GITHUB_ENV

- name: VERSION to job output
id: output-version
run: |
echo "VERSION=${{ env.VERSION }}" >> $GITHUB_OUTPUT
echo "ASSEMBLY_VERSION=${{ env.ASSEMBLY_VERSION }}" >> $GITHUB_OUTPUT

deploy-nuget:
name: Deploy mudblazor.staticInput nuget to nuget.org
Expand All @@ -52,7 +65,7 @@ jobs:
with:
dotnet-version: 9.0.x
- name: Pack nuget package
run: dotnet pack -c Release --output nupkgs /p:PackageVersion=${{ needs.get-version.outputs.VERSION }} /p:AssemblyVersion=${{ needs.get-version.outputs.VERSION }} /p:Version=${{ needs.get-version.outputs.VERSION }}
run: dotnet pack -c Release --output nupkgs /p:PackageVersion=${{ needs.get-version.outputs.VERSION }} /p:AssemblyVersion=${{ needs.get-version.outputs.ASSEMBLY_VERSION }} /p:Version=${{ needs.get-version.outputs.VERSION }}
working-directory: ./src
- name: Publish nuget package
run: dotnet nuget push nupkgs/*.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
Expand Down
Loading