Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
stamepicmorg committed Sep 29, 2024
1 parent 3f95b2a commit c6999a6
Showing 1 changed file with 28 additions and 14 deletions.
42 changes: 28 additions & 14 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ jobs:
GITHUB_RUN_NUMBER: ${{ github.run_number }}
shell: pwsh

- name: Get version from project
id: get_version
run: |
$version_file = "${{ github.workspace }}/src/kasthack.binding.wf.csproj"
$current_version = (Get-Content $version_file | Select-String -Pattern '<Version>(.*?)</Version>').Matches.Groups[1].Value
if (-not $current_version) {
throw "Could not read version from: $version_file"
}
echo "Current version is: $current_version"
echo "PROJECT_VERSION=$current_version" >> $GITHUB_ENV
shell: pwsh

- name: Restore dependencies in project
run: dotnet restore

Expand All @@ -55,28 +67,30 @@ jobs:
if: matrix.configuration == 'Release'
run: dotnet pack --configuration Release --output ./nupkg

- name: Upload the artifact [Debug]
if: matrix.configuration == 'Debug'
uses: actions/upload-artifact@v4
with:
name: debug.kasthack.binding.wf.${{ env.PROJECT_VERSION }}.nupkg
path: nupkg\kasthack.binding.wf.${{ env.PROJECT_VERSION }}.nupkg

- name: Upload the artifact [Release]
if: matrix.configuration == 'Release'
uses: actions/upload-artifact@v4
with:
name: debug.kasthack.binding.wf.${{ env.PROJECT_VERSION }}.nupkg
path: nupkg\kasthack.binding.wf.${{ env.PROJECT_VERSION }}.nupkg

# - name: Push NuGet package
# if: matrix.configuration == 'Release'
# run: dotnet nuget push ./nupkg/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json

- name: Get version from project
id: get_version
run: |
$version_file = "${{ github.workspace }}/src/kasthack.binding.wf.csproj"
$current_version = (Get-Content $version_file | Select-String -Pattern '<Version>(.*?)</Version>').Matches.Groups[1].Value
if (-not $current_version) {
throw "Could not read version from: $version_file"
}
echo "Current version is: $current_version"
echo "current_version=$current_version" >> $GITHUB_ENV
shell: pwsh

- name: Create GitHub Release
if: matrix.configuration == 'Release'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.new_version }}
name: ${{ env.new_version }}
tag_name: ${{ env.PROJECT_VERSION }}
name: ${{ env.PROJECT_VERSION }}
files: ./nupkg/*.nupkg
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit c6999a6

Please sign in to comment.