⬆️ Bump files with dotnet-file sync #562
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
| # Builds and runs tests in all three supported OSes | |
| # Pushes CI feed if secrets.SLEET_CONNECTION is provided | |
| name: build | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [ main, dev, 'dev/*', 'feature/*', 'rel/*' ] | |
| paths-ignore: | |
| - changelog.md | |
| - code-of-conduct.md | |
| - security.md | |
| - support.md | |
| - readme.md | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| release: | |
| types: [released] | |
| env: | |
| DOTNET_NOLOGO: true | |
| SLEET_CONNECTION: ${{ secrets.SLEET_CONNECTION }} | |
| MSBUILDTERMINALLOGGER: auto | |
| GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
| Configuration: ${{ github.event.inputs.configuration || 'Release' }} | |
| SLEET_FEED_URL: ${{ vars.SLEET_FEED_URL }} | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| version: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.release.outputs.version }} | |
| label: ${{ steps.dev.outputs.label }} | |
| prefix: ${{ steps.dev.outputs.prefix }} | |
| steps: | |
| - name: release | |
| id: release | |
| if: github.event_name == 'release' | |
| run: | | |
| echo "version=${GITHUB_REF#refs/*/v}" >> $GITHUB_OUTPUT | |
| - name: dev | |
| id: dev | |
| if: github.event_name != 'release' | |
| run: | | |
| echo "label=$GITHUB_REF" >> $GITHUB_OUTPUT | |
| echo "prefix=42.42.$GITHUB_RUN_NUMBER" >> $GITHUB_OUTPUT | |
| build: | |
| name: build-${{ matrix.os }} | |
| needs: version | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ 'macOS-latest', 'ubuntu-latest', 'windows-latest' ] | |
| env: | |
| Version: ${{ needs.version.outputs.version }} | |
| VersionLabel: ${{ needs.version.outputs.label }} | |
| VersionPrefix: ${{ needs.version.outputs.prefix }} | |
| steps: | |
| - name: 🤘 checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: 🙏 build | |
| run: dotnet build | |
| - name: 📦 pack | |
| run: dotnet pack | |
| - name: ⬆️ upload | |
| # Only upload package from windows (can't run ILRepack on linux/macOS) | |
| if: success() && matrix.os == 'windows-latest' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pkg | |
| path: bin/* | |
| test: | |
| needs: [version, build] | |
| name: test-${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ 'macOS-latest', 'ubuntu-latest', 'windows-latest' ] | |
| env: | |
| Version: ${{ needs.version.outputs.version }} | |
| VersionLabel: ${{ needs.version.outputs.label }} | |
| steps: | |
| - name: 🤘 checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: ⬇️ artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pkg | |
| path: bin | |
| - name: ⚙ dotnet | |
| uses: devlooped/actions-dotnet-env@v1 | |
| - name: 🙏 build | |
| run: dotnet build | |
| - name: 🧪 test | |
| run: | | |
| dotnet tool update -g dotnet-retest | |
| dotnet retest -- --no-build | |
| - name: 🐛 logs | |
| uses: actions/upload-artifact@v4 | |
| if: runner.debug && always() | |
| with: | |
| name: test-${{ matrix.os }} | |
| path: '*.binlog' | |
| push: | |
| needs: test | |
| if: success() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: ⬇️ artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pkg | |
| path: bin | |
| - name: ⚙ dotnet | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: | | |
| 8.x | |
| 9.x | |
| - name: 🚀 sleet | |
| env: | |
| SLEET_CONNECTION: ${{ secrets.SLEET_CONNECTION }} | |
| if: env.SLEET_CONNECTION != '' | |
| run: | | |
| dotnet tool update sleet -g --allow-downgrade --version $(curl -s --compressed ${{ vars.SLEET_FEED_URL }} | jq '.["sleet:version"]' -r) | |
| sleet push ./bin/*.nupkg --config none -f --verbose -p "SLEET_FEED_CONTAINER=nuget" -p "SLEET_FEED_CONNECTIONSTRING=${{ secrets.SLEET_CONNECTION }}" -p "SLEET_FEED_TYPE=azure" || echo "No packages found" | |
| publish: | |
| needs: test | |
| if: github.event_name == 'release' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: ⬇️ artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pkg | |
| path: bin | |
| - name: 🚀 nuget | |
| run: dotnet nuget push ./bin/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}} --skip-duplicate | |
| dotnet-format: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 🤘 checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: ✓ ensure format | |
| run: dotnet format --verify-no-changes -v:diag --exclude ~/.nuget |