|
| 1 | +name: Release NuGet Packages |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + |
| 8 | +env: |
| 9 | + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true |
| 10 | + DOTNET_CLI_TELEMETRY_OPTOUT: true |
| 11 | + |
| 12 | +jobs: |
| 13 | + publish: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Setup .NET |
| 19 | + uses: actions/setup-dotnet@v4 |
| 20 | + with: |
| 21 | + dotnet-version: '9.0.x' |
| 22 | + |
| 23 | + - name: Extract version from tag |
| 24 | + id: version |
| 25 | + run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT |
| 26 | + |
| 27 | + - name: Restore |
| 28 | + run: dotnet restore |
| 29 | + |
| 30 | + - name: Build |
| 31 | + run: dotnet build -c Release --no-restore |
| 32 | + |
| 33 | + - name: Test |
| 34 | + run: dotnet test -c Release --no-build |
| 35 | + |
| 36 | + - name: Pack libraries |
| 37 | + run: | |
| 38 | + dotnet pack Other/Selecta/Selecta.csproj -c Release -p:Version=${{ steps.version.outputs.VERSION }} -o ./nupkgs |
| 39 | + dotnet pack Migration/Migration/Migration.csproj -c Release -p:Version=${{ steps.version.outputs.VERSION }} -o ./nupkgs |
| 40 | + dotnet pack Migration/Migration.SQLite/Migration.SQLite.csproj -c Release -p:Version=${{ steps.version.outputs.VERSION }} -o ./nupkgs |
| 41 | + dotnet pack Migration/Migration.Postgres/Migration.Postgres.csproj -c Release -p:Version=${{ steps.version.outputs.VERSION }} -o ./nupkgs |
| 42 | + dotnet pack DataProvider/DataProvider/DataProvider.csproj -c Release -p:Version=${{ steps.version.outputs.VERSION }} -o ./nupkgs |
| 43 | + dotnet pack DataProvider/DataProvider.SQLite/DataProvider.SQLite.csproj -c Release -p:Version=${{ steps.version.outputs.VERSION }} -o ./nupkgs |
| 44 | +
|
| 45 | + - name: Pack CLI tools |
| 46 | + run: | |
| 47 | + dotnet pack DataProvider/DataProvider.Postgres.Cli/DataProvider.Postgres.Cli.csproj -c Release -p:Version=${{ steps.version.outputs.VERSION }} -o ./nupkgs |
| 48 | + dotnet pack DataProvider/DataProvider.SQLite.Cli/DataProvider.SQLite.Cli.csproj -c Release -p:Version=${{ steps.version.outputs.VERSION }} -o ./nupkgs |
| 49 | + dotnet pack Migration/Migration.Cli/Migration.Cli.csproj -c Release -p:Version=${{ steps.version.outputs.VERSION }} -o ./nupkgs |
| 50 | +
|
| 51 | + - name: Push to NuGet |
| 52 | + run: dotnet nuget push "./nupkgs/*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate |
| 53 | + |
| 54 | + - name: Create GitHub Release |
| 55 | + uses: softprops/action-gh-release@v1 |
| 56 | + with: |
| 57 | + files: ./nupkgs/*.nupkg |
| 58 | + generate_release_notes: true |
0 commit comments