Skip to content

Merge pull request #1070 from DmytroMuravskyi/dmuravskyi/grid-fix #503

Merge pull request #1070 from DmytroMuravskyi/dmuravskyi/grid-fix

Merge pull request #1070 from DmytroMuravskyi/dmuravskyi/grid-fix #503

name: Tag and Publish Alpha
on:
push:
branches:
- master
jobs:
build-bump-alpha-publish:
runs-on: ubuntu-20.04
steps:
- name: Checkout repo.
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Get previous tag.
id: version
run: |
lastTag=`git tag -l '[!v]*' --sort=-version:refname | head -n 1`
echo "::set-output name=tag::$lastTag"
- name: Bump if alpha.
id: bump-with-alpha
uses: actions/github-script@v3
with:
result-encoding: string
script: |
const incoming = "${{steps.version.outputs.tag}}"
console.log("Incoming Tag: " + incoming)
if(incoming.includes('alpha')) {
const oldNum = incoming.match(/alpha[.]*(\d+)/)[1]
const newNum = parseInt(oldNum)+1
const newTag = incoming.replace(/alpha.*\d+/, `alpha.${newNum}`)
console.log("New Tag: " + newTag)
return newTag
}
else {
const splitLast = incoming.match(/(.*\.)(\d*)/)
const newTag =splitLast[1] + (parseInt(splitLast[2])+1)+'-alpha.0'
console.log("New Tag: " + newTag)
return newTag
}
- name: Set NuGet version from alpha.
run: echo "NUGET_VERSION=${{steps.bump-with-alpha.outputs.result}}" >> $GITHUB_ENV
- name: Build Elements
run: dotnet build -c release -p:Version=${{ env.NUGET_VERSION }}
- name: Create alpha tag.
uses: tvdias/[email protected]
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.bump-with-alpha.outputs.result }}
- name: Publish NuGet package.
run: |
dotnet nuget push ./nupkg/Hypar.Elements.${{ env.NUGET_VERSION }}.nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}}
dotnet nuget push ./nupkg/Hypar.Elements.CodeGeneration.${{ env.NUGET_VERSION }}.nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}}
dotnet nuget push ./nupkg/Hypar.Elements.Serialization.DXF.${{ env.NUGET_VERSION }}.nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}}
dotnet nuget push ./nupkg/Hypar.Elements.Serialization.IFC.${{ env.NUGET_VERSION }}.nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}}
dotnet nuget push ./nupkg/Hypar.Elements.Components.${{ env.NUGET_VERSION }}.nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}}
dotnet nuget push ./nupkg/Hypar.Elements.MEP.${{ env.NUGET_VERSION }}.nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}}