Skip to content

Commit

Permalink
Merge pull request #10 from NikRimington/dev/v1
Browse files Browse the repository at this point in the history
[AMEND] More advanced workflow behaviour for build / pack / publish
  • Loading branch information
NikRimington authored Oct 1, 2024
2 parents b4a396b + 179ea00 commit 125f2b2
Showing 1 changed file with 45 additions and 5 deletions.
50 changes: 45 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,52 @@ jobs:
uses: actions/setup-dotnet@v2
with:
dotnet-version: 8.0.x

- name: Set VERSION variable from tag
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV

- name: Build project
run: dotnet build src\AccessibleMediaPicker\HCS.Media.AccessibleMediaPicker.csproj --configuration Release /p:Version=${VERSION}
run: dotnet build src\AccessibleMediaPicker\HCS.Media.AccessibleMediaPicker.csproj --configuration Release

pack:
runs-on: windows-latest
needs: build
if: github.event_name == 'push'
steps:

- name: Checkout repository
uses: actions/checkout@v3

- name: Setup .NET v6
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x

- name: Setup .NET v8
uses: actions/setup-dotnet@v2
with:
dotnet-version: 8.0.x

- name: Determine version
run: echo "::set-env name=VERSION::$(git describe --tags --dirty)"

- name: Pack
run: dotnet pack --output ./artifacts --configuration Release -p:Version=$VERSION
- uses: actions/upload-artifact@v4
with:
name: artifacts
path: ./artifacts

publish:
runs-on: ubuntu-latest
needs: pack
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- name: Setup .NET v8
uses: actions/setup-dotnet@v2
with:
dotnet-version: 8.0.x
- uses: actions/download-artifact@v4
with:
name: artifacts
path: ./artifacts

- name: Push to NuGet
run: dotnet nuget push **\*.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json
run: dotnet nuget push ./artifacts/**.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json

0 comments on commit 125f2b2

Please sign in to comment.