Automatic releases #40
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: Automatic releases | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 3 * * 0' | |
| jobs: | |
| build: | |
| name: Build & publish | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkouting code... | |
| uses: actions/checkout@v5 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: '7.0.x' | |
| - name: Preparing nuget source | |
| run: dotnet nuget add source --username SkyCD --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/SkyCD/index.json" | |
| - name: Restoring packages | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build --configuration Release | |
| - name: Releasing if there is something new... | |
| uses: impresscms-dev/simple-autorelease-action@v0.2 | |
| id: autorelease | |
| with: | |
| release_branch: main | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| default_bump: minor | |
| - name: Generating publishing params... | |
| id: params | |
| run: | | |
| APP_VERSION=$(echo "${{ steps.autorelease.outputs.new_version }}" | sed -r 's/v//g') | |
| echo "params=-p:Version=$APP_VERSION" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - name: Pack | |
| if: steps.autorelease.outputs.not_released == 'false' | |
| run: dotnet pack --output ./artifacts --configuration Release ${{steps.params.outputs.params}} | |
| - name: Publish to GitHub packages | |
| if: steps.autorelease.outputs.not_released == 'false' | |
| run: dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "github" |