|
| 1 | +name: Release a new version of the plugin |
| 2 | + |
| 3 | +# Release is made by pushin a tag with format 'vX.Y.Z' (ex: v1.0.2) |
| 4 | + |
| 5 | +on: |
| 6 | + push: |
| 7 | + tags: |
| 8 | + - 'v\d.\d.\d' |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + |
| 13 | + runs-on: [windows-latest] |
| 14 | + |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v1 |
| 17 | + |
| 18 | + - name: Extract version |
| 19 | + shell: bash |
| 20 | + run: echo "##[set-output name=version;]$(echo ${GITHUB_REF##*/v})" |
| 21 | + id: extract_version |
| 22 | + |
| 23 | + - name: Update version in csproj |
| 24 | + uses: datamonsters/replace-action@v2 |
| 25 | + with: |
| 26 | + files: 'src/${{ github.event.repository.name }}/${{ github.event.repository.name }}.csproj' |
| 27 | + replacements: '<VersionPrefix>0.0.0</VersionPrefix>=<VersionPrefix>${{ steps.extract_version.outputs.version }}</VersionPrefix>' |
| 28 | + |
| 29 | + - name: Setup .NET Core |
| 30 | + uses: actions/setup-dotnet@v1 |
| 31 | + with: |
| 32 | + dotnet-version: 2.2.108 |
| 33 | + |
| 34 | + - name: Setup MSBuild.exe |
| 35 | + uses: warrenbuckley/Setup-MSBuild@v1 |
| 36 | + |
| 37 | + - name: Build & package with `msbuild` |
| 38 | + run: | |
| 39 | + msbuild -target:restore -property:Configuration=Release |
| 40 | + msbuild -target:pack -property:Configuration=Release |
| 41 | +
|
| 42 | + - name: Upload artifact |
| 43 | + uses: actions/upload-artifact@v1 |
| 44 | + with: |
| 45 | + name: ${{ github.event.repository.name }}.nupkg |
| 46 | + path: src/${{ github.event.repository.name }}/bin/Release/${{ github.event.repository.name }}.${{ steps.extract_version.outputs.version }}.nupkg |
| 47 | + |
| 48 | + - name: Push to Nuget.org nuget feed |
| 49 | + run: | |
| 50 | + cd "src/${{ github.event.repository.name }}/bin/Release" |
| 51 | + dotnet nuget push *.nupkg -k ${{ secrets.NUGET_PUSH_TOKEN }} -s https://api.nuget.org/v3/index.json -n true |
0 commit comments