Publish Nuget Package to Release #46
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 Nuget Package to Release | |
on: | |
release: | |
types: ["created"] | |
jobs: | |
build-nuget: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 6.0.x | |
- name: Get ReleaseVersion from Tag | |
uses: actions/[email protected] | |
id: get_version | |
with: | |
script: | | |
const release_tag = context.ref.substring(10) | |
const release_version = release_tag.replace('v','') | |
core.setOutput('release_tag', release_tag) | |
core.setOutput('release_version', release_version) | |
console.log('Release Tag ' + release_tag) | |
console.log('Release Version ' + release_version) | |
- name: Restore | |
run: dotnet restore CoreHelpers.WindowsAzure.Storage.Table.sln | |
env: | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
- name: Build | |
run: dotnet build --no-restore -c Release CoreHelpers.WindowsAzure.Storage.Table.sln -p:Version=${{ steps.get_version.outputs.release_version }} | |
env: | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
- name: Test | |
run: dotnet test --no-restore CoreHelpers.WindowsAzure.Storage.Table.sln -e STORAGE="${{ secrets.XUNIT_CONNECTIONSTRING }}" | |
- name: Pack Abstraction | |
run: dotnet pack ./CoreHelpers.WindowsAzure.Storage.Table.Abstractions --configuration Release -p:PackageVersion=${{ steps.get_version.outputs.release_version }} --output . | |
- name: Pack Implementation | |
run: dotnet pack ./CoreHelpers.WindowsAzure.Storage.Table --configuration Release -p:PackageVersion=${{ steps.get_version.outputs.release_version }} --output . | |
- name: Pack Backup Abstraction | |
run: dotnet pack ./CoreHelpers.WindowsAzure.Storage.Table.Backup.Abstractions --configuration Release -p:PackageVersion=${{ steps.get_version.outputs.release_version }} --output . | |
- name: Pack Backup Implementation | |
run: dotnet pack ./CoreHelpers.WindowsAzure.Storage.Table.Backup --configuration Release -p:PackageVersion=${{ steps.get_version.outputs.release_version }} --output . | |
- name: Upload Nuget Package to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: CoreHelpers.WindowsAzure.Storage.Table.${{ steps.get_version.outputs.release_version }}.nupkg | |
asset_name: CoreHelpers.WindowsAzure.Storage.Table.${{ steps.get_version.outputs.release_version }}.nupkg | |
tag: ${{ steps.get_version.outputs.release_tag }} | |
overwrite: true | |
- name: Upload Nuget Package to release (Abstractions) | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: CoreHelpers.WindowsAzure.Storage.Table.Abstractions.${{ steps.get_version.outputs.release_version }}.nupkg | |
asset_name: CoreHelpers.WindowsAzure.Storage.Table.Abstractions.${{ steps.get_version.outputs.release_version }}.nupkg | |
tag: ${{ steps.get_version.outputs.release_tag }} | |
overwrite: true | |
- name: Upload Nuget Package to release (Backup) | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: CoreHelpers.WindowsAzure.Storage.Table.Backup.${{ steps.get_version.outputs.release_version }}.nupkg | |
asset_name: CoreHelpers.WindowsAzure.Storage.Table.Backup.${{ steps.get_version.outputs.release_version }}.nupkg | |
tag: ${{ steps.get_version.outputs.release_tag }} | |
overwrite: true | |
- name: Upload Nuget Package to release (Backup Abtractions) | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: CoreHelpers.WindowsAzure.Storage.Table.Backup.Abstractions.${{ steps.get_version.outputs.release_version }}.nupkg | |
asset_name: CoreHelpers.WindowsAzure.Storage.Table.Backup.Abstractions.${{ steps.get_version.outputs.release_version }}.nupkg | |
tag: ${{ steps.get_version.outputs.release_tag }} | |
overwrite: true | |
- name: Publish NuGet | |
run: dotnet nuget push ./*.nupkg --api-key ${{ secrets.NUGET_TOKEN }} -s https://api.nuget.org/v3/index.json |