fix image for nuget.org #12
Workflow file for this run
This file contains hidden or 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: Create Release on Tag | |
on: | |
push: | |
# Sequence of patterns matched against refs/tags | |
tags: | |
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | |
env: | |
solutionPath: '${{ github.workspace }}/src/Dataverse.ConfigurationMigrationTool/Dataverse.ConfigurationMigrationTool.sln' | |
solutionFolder: '${{ github.workspace }}/src/Dataverse.ConfigurationMigrationTool' | |
toolpublishlocation: '${{ github.workspace }}/configurationmigrationtool' | |
xtbpublishlocation: '${{ github.workspace }}/xtb' | |
xrmToolboxPath: 'src/Dataverse.ConfigurationMigrationTool/Dataverse.ConfigurationMigrationTool.XrmToolBox/Dataverse.ConfigurationMigrationTool.XrmToolBox.csproj' | |
jobs: | |
buildLinux: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore dependencies | |
run: dotnet restore ${{ env.solutionPath }} | |
- name: Build | |
run: dotnet build ${{ env.solutionPath }} --configuration Release --no-restore | |
- name: dotnet publish | |
run: dotnet publish ${{ env.solutionFolder }}/Dataverse.ConfigurationMigrationTool.Console/Dataverse.ConfigurationMigrationTool.Console.csproj -c Release -o ${{env.toolpublishlocation}} | |
- name: Upload tool artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: configurationmigrationtool | |
path: ${{env.toolpublishlocation}} | |
buildwindows: | |
runs-on: windows-latest | |
steps: | |
- name: git configure long path | |
run: git config --global core.longpaths true | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
versionSpec: '6.3.x' | |
- name: Determine Version | |
id: gitversion # step id used as reference for output values | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
updateAssemblyInfo: true | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
- name: Setup NuGet | |
uses: nuget/setup-nuget@v1 | |
with: | |
nuget-version: 'latest' # Or a specific version like '5.11.1' | |
- name: Add msbuild to PATH | |
uses: microsoft/setup-msbuild@v2 | |
- name: Restore NuGet packages | |
run: nuget restore ${{ env.solutionPath }} # Replace with your solution file or project directory | |
- name: Build xrmToolBox | |
run: msbuild ${{ env.xrmToolboxPath }} -t:rebuild -verbosity:diag -property:Configuration=Release | |
- name: Nuget Pack | |
run: nuget pack src/Dataverse.ConfigurationMigrationTool/Dataverse.ConfigurationMigrationTool.XTB.nuspec -Version ${{ steps.gitversion.outputs.assemblySemFileVer }} | |
- name: Create destination folder | |
run: mkdir -p ${{env.xtbpublishlocation}} | |
- name: Copy files using wildcard | |
run: cp *.nupkg ${{env.xtbpublishlocation}} | |
- name: Upload tool artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: configurationmigrationtool_xrmtoolbox | |
path: ${{env.xtbpublishlocation}} | |
release: | |
name: Create Release from tag | |
needs: [ buildLinux, buildwindows] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download clitool artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: configurationmigrationtool | |
path: '${{ github.workspace }}/configurationmigrationtool' | |
- name: Download xtbtool artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: configurationmigrationtool_xrmtoolbox | |
path: '${{ env.xtbpublishlocation }}' | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
- name: zip artifact # This would actually build your project, using zip for an example artifact | |
run: | | |
zip -r configurationmigrationtool${{ github.ref_name }}.zip configurationmigrationtool | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
- name: Get nupkg path | |
id: get_nupkg_path | |
run: | | |
NUPKG_PATH=$(ls ./xtb/*.nupkg | head -n 1) | |
FILENAME=$(basename "$NUPKG_PATH") | |
echo "nupkg_path=$NUPKG_PATH" >> "$GITHUB_OUTPUT" | |
echo "filename=$FILENAME" >> "$GITHUB_OUTPUT" # Make it available to subsequent steps | |
- name: Push To NuGet Registry | |
run: | | |
dotnet nuget push ./xtb/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json | |
- name: Upload NuGet Package Release Asset | |
id: upload-nuget-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ${{ steps.get_nupkg_path.outputs.nupkg_path }} | |
asset_name: ${{ steps.get_nupkg_path.outputs.filename }} | |
asset_content_type: application/zip | |
- name: Upload CLI Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ./configurationmigrationtool${{ github.ref_name }}.zip | |
asset_name: configurationmigrationtool${{ github.ref_name }}.zip | |
asset_content_type: application/zip |