RedistTool #72
Workflow file for this run
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: RedistTool | |
| on: | |
| create: | |
| tags: | |
| - "*" | |
| push: | |
| branches: [ master ] | |
| paths: | |
| - '.github/workflows/RedistTool.yaml' | |
| - 'src/**' | |
| - 'tests/**' | |
| pull_request: | |
| paths: | |
| - '.github/workflows/RedistTool.yaml' | |
| - 'src/**' | |
| - 'tests/**' | |
| jobs: | |
| Build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 # full history so 'git describe' can derive the version | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| env: | |
| DOTNET_NOLOGO: true | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
| DOTNET_CLI_TELEMETRY_OPTOUT: true | |
| with: | |
| dotnet-version: 9.x | |
| - name: Create version | |
| id: version | |
| run: | | |
| latest_tag=$(git rev-list --tags --max-count=1) | |
| if [ -n "$latest_tag" ]; then | |
| version="$(git describe --tags "$latest_tag")+$(git rev-parse --short HEAD)" | |
| else | |
| version="0.0.0+$(git rev-parse --short HEAD)" | |
| fi | |
| echo "version=$version" >> "$GITHUB_OUTPUT" | |
| # A '-' (e.g. an "-rc" tag) marks a prerelease; '+build' metadata does not. | |
| if [[ "$version" == *-* ]]; then | |
| echo "is_prerelease=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "is_prerelease=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Build | |
| run: > | |
| dotnet build src/UnturnedRedistUpdateTool/UnturnedRedistUpdateTool.csproj | |
| --configuration Release | |
| --runtime linux-x64 | |
| -p:RedistUpdateToolVersion=${{ steps.version.outputs.version }} | |
| - name: Test | |
| run: > | |
| dotnet test tests/UnturnedRedistUpdateTool.Tests/UnturnedRedistUpdateTool.Tests.csproj | |
| --configuration Release | |
| --runtime linux-x64 | |
| - name: Zip UnturnedRedistUpdateTool artifacts | |
| run: "cd ./src/UnturnedRedistUpdateTool/bin/Release/net9.0/linux-x64 && zip -qq -r ./UnturnedRedistUpdateTool.zip *" | |
| - name: Upload UnturnedRedistUpdateTool | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: UnturnedRedistUpdateTool.zip | |
| path: "./src/UnturnedRedistUpdateTool/bin/Release/net9.0/linux-x64/UnturnedRedistUpdateTool.zip" | |
| if-no-files-found: error | |
| - name: Create Release | |
| if: github.event_name == 'create' && github.event.ref_type == 'tag' | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| name: UnturnedRedistUpdateTool Release v${{ steps.version.outputs.version }} | |
| tag: ${{ steps.version.outputs.version }} | |
| artifacts: "./src/UnturnedRedistUpdateTool/bin/Release/net9.0/linux-x64/UnturnedRedistUpdateTool.zip" | |
| token: ${{ secrets.PAT }} | |
| prerelease: ${{ steps.version.outputs.is_prerelease }} | |
| allowUpdates: true | |
| draft: false |