string API extension (+semver: feature) (#226) #57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release Workflow | |
| on: | |
| push: | |
| branches: | |
| - 'release' | |
| permissions: | |
| contents: write | |
| issues: write | |
| actions: write | |
| jobs: | |
| create-release: | |
| name: Create release | |
| runs-on: ubuntu-latest | |
| outputs: | |
| determined_version: ${{ steps.version_step.outputs.majorMinorPatch }} | |
| publish_version: ${{ steps.version_step.outputs.publishVersion }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| - name: Determine Version | |
| id: version_step | |
| run: | | |
| tag=$( git describe --tags --abbrev=0 ) | |
| echo "majorMinorPatch=$tag" >> $GITHUB_OUTPUT | |
| echo "publishVersion=${tag:1}" >> $GITHUB_OUTPUT | |
| - name: Setup GitReleaseManager | |
| uses: gittools/actions/gitreleasemanager/setup@v4.2.0 | |
| with: | |
| versionSpec: '0.20.x' | |
| - name: Create release with GitReleaseManager | |
| uses: gittools/actions/gitreleasemanager/create@v4.2.0 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| repository: 'Stepami/hydrascript' | |
| milestone: ${{ steps.version_step.outputs.majorMinorPatch }} | |
| name: ${{ steps.version_step.outputs.majorMinorPatch }} | |
| upload-release-assets: | |
| name: Upload release assets | |
| needs: create-release | |
| outputs: | |
| determined_version: ${{ needs.create-release.outputs.determined_version }} | |
| publish_version: ${{ needs.create-release.outputs.publish_version }} | |
| strategy: | |
| matrix: | |
| config: | |
| - os: ubuntu-latest | |
| rid: linux-x64 | |
| - os: macos-latest | |
| rid: osx-arm64 | |
| - os: windows-latest | |
| rid: win-x64 | |
| runs-on: ${{ matrix.config.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: 10.0.x | |
| - name: Setup GitReleaseManager | |
| uses: gittools/actions/gitreleasemanager/setup@v4.2.0 | |
| with: | |
| versionSpec: '0.20.x' | |
| - name: Publish | |
| run: | | |
| mkdir output | |
| dotnet publish ./src/HydraScript/HydraScript.csproj -r ${{ matrix.config.rid }} -p:Version=${{ needs.create-release.outputs.publish_version }} -o ./output | |
| - name: Rename Executable | |
| run: mv ./output/HydraScript${{ matrix.config.rid == 'win-x64' && '.exe' || '' }} ./output/hydrascript_${{ matrix.config.rid }}${{ matrix.config.rid == 'win-x64' && '.exe' || '' }} | |
| - name: Add asset to a release with GitReleaseManager | |
| uses: gittools/actions/gitreleasemanager/addasset@v4.2.0 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| repository: 'Stepami/hydrascript' | |
| milestone: ${{ needs.create-release.outputs.determined_version }} | |
| assets: ./output/hydrascript_${{ matrix.config.rid }}${{ matrix.config.rid == 'win-x64' && '.exe' || '' }} | |
| publish-release: | |
| name: Publish release | |
| runs-on: ubuntu-latest | |
| needs: upload-release-assets | |
| outputs: | |
| publish_version: ${{ needs.upload-release-assets.outputs.publish_version }} | |
| steps: | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| - name: Setup GitReleaseManager | |
| uses: gittools/actions/gitreleasemanager/setup@v4.2.0 | |
| with: | |
| versionSpec: '0.20.x' | |
| - name: Publish release with GitReleaseManager | |
| uses: gittools/actions/gitreleasemanager/publish@v4.2.0 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| repository: 'Stepami/hydrascript' | |
| milestone: ${{ needs.upload-release-assets.outputs.determined_version }} | |
| - name: Close release with GitReleaseManager | |
| uses: gittools/actions/gitreleasemanager/close@v4.2.0 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| repository: 'Stepami/hydrascript' | |
| milestone: ${{ needs.upload-release-assets.outputs.determined_version }} | |
| publish-nuget: | |
| name: Publish as dotnet tool to NuGet | |
| runs-on: windows-latest | |
| needs: publish-release | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: 10.0.x | |
| - name: Build | |
| run: dotnet build ./src/HydraScript/HydraScript.csproj -c Release -v n ` | |
| -p:Version=${{ needs.publish-release.outputs.publish_version }} ` | |
| -p:PublishAot=false -p:PublishSingleFile=false | |
| - name: Publish | |
| run: dotnet nuget push (ls "./src/HydraScript/bin/Release/*.nupkg") ` | |
| --api-key ${{ secrets.NUGET_API_KEY }} ` | |
| --source "https://api.nuget.org/v3/index.json" |