[meta] feat: bump version to 1.0.1 #25
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: CI | |
| on: | |
| pull_request: | |
| paths-ignore: | |
| - "**.md" | |
| - LICENSE | |
| push: | |
| paths-ignore: | |
| - "**.md" | |
| - LICENSE | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| env: | |
| DOTNET_NOLOGO: true | |
| jobs: | |
| test: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| key: u | |
| - os: macos-latest | |
| key: m | |
| - os: windows-latest | |
| key: w | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-dotnet@v5 | |
| with: | |
| global-json-file: global.json | |
| - name: Build | |
| shell: bash | |
| run: dotnet build "pefix.sln" -c Release -m:1 | |
| - name: Test cover | |
| shell: bash | |
| run: >- | |
| dotnet test --project "tests/PeFix.Tests.csproj" --no-build -c Release | |
| -- | |
| --coverlet | |
| --coverlet-output-format cobertura | |
| --coverlet-include "[pefix]*" | |
| --coverlet-exclude-by-file "**/obj/**" | |
| --report-xunit-trx | |
| - uses: actions/upload-artifact@v7 | |
| if: always() | |
| with: | |
| name: coverage-${{ matrix.key }} | |
| path: "**/coverage.cobertura.xml" | |
| - uses: actions/upload-artifact@v7 | |
| if: failure() | |
| with: | |
| name: test-${{ matrix.key }} | |
| path: "**/*.trx" | |
| publish: | |
| needs: test | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| rid: linux-x64 | |
| key: lx | |
| - os: macos-latest | |
| rid: osx-arm64 | |
| key: oa | |
| - os: windows-latest | |
| rid: win-x64 | |
| key: wx | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-dotnet@v5 | |
| with: | |
| global-json-file: global.json | |
| - name: Publish | |
| if: github.event_name != 'push' || !startsWith(github.ref, 'refs/tags/v') | |
| shell: bash | |
| run: dotnet publish "src/PeFix/PeFix.csproj" -c Release -r "${{ matrix.rid }}" --output "artifacts/${{ matrix.rid }}" | |
| - uses: actions/upload-artifact@v7 | |
| if: github.event_name != 'push' || !startsWith(github.ref, 'refs/tags/v') | |
| with: | |
| name: pefix-${{ matrix.key }} | |
| path: artifacts/${{ matrix.rid }} | |
| - name: Pack RID | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
| shell: bash | |
| run: dotnet pack "src/PeFix/PeFix.csproj" -c Release -r "${{ matrix.rid }}" --output "artifacts/pkg/${{ matrix.rid }}" | |
| - uses: actions/upload-artifact@v7 | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
| with: | |
| name: nupkg-${{ matrix.key }} | |
| path: artifacts/pkg/${{ matrix.rid }}/*.nupkg | |
| if-no-files-found: error | |
| nupkg-root: | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-dotnet@v5 | |
| with: | |
| global-json-file: global.json | |
| - name: Pack root | |
| shell: bash | |
| run: dotnet pack "src/PeFix/PeFix.csproj" -c Release --output "artifacts/pkg/root" | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: nupkg-root | |
| path: artifacts/pkg/root/*.nupkg | |
| if-no-files-found: error | |
| release: | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
| needs: [publish, nupkg-root] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-dotnet@v5 | |
| with: | |
| global-json-file: global.json | |
| - uses: actions/download-artifact@v7 | |
| with: | |
| path: artifacts/ | |
| - name: Pack assets | |
| shell: bash | |
| run: | | |
| for rid in linux-x64 osx-arm64 win-x64; do | |
| packages="$(find artifacts -type f -name "pefix.${rid}.*.nupkg" | sort)" | |
| pkg_count="$(printf '%s\n' "${packages}" | sed '/^$/d' | wc -l | tr -d ' ')" | |
| if [[ "${pkg_count}" -ne 1 ]]; then | |
| echo "Expected 1 ${rid} NuGet package, found ${pkg_count}." >&2 | |
| printf '%s\n' "${packages}" >&2 | |
| exit 1 | |
| fi | |
| package="${packages}" | |
| out_dir="artifacts/x/${rid}" | |
| mkdir -p "${out_dir}" | |
| unzip -q "${package}" -d "${out_dir}" | |
| tool_dir="$(find "${out_dir}/tools" -mindepth 2 -maxdepth 2 -type d -name "${rid}" | head -n1)" | |
| if [[ -z "${tool_dir}" || ! -d "${tool_dir}" ]]; then | |
| echo "Expected tool directory ${out_dir}/tools/<tfm>/${rid} in ${package}." >&2 | |
| find "${out_dir}" -maxdepth 4 -type d >&2 | |
| exit 1 | |
| fi | |
| if [[ "$rid" == win-* ]]; then | |
| (cd "${tool_dir}" && zip -r "${GITHUB_WORKSPACE}/artifacts/pefix-${rid}.zip" .) | |
| else | |
| tar -C "${tool_dir}" -czf "artifacts/pefix-${rid}.tar.gz" . | |
| fi | |
| done | |
| ls -la artifacts/pefix-*.tar.gz artifacts/pefix-*.zip | |
| - name: Push NuGet | |
| env: | |
| NUGET_KEY: ${{ secrets.NUGET_API_KEY }} | |
| shell: bash | |
| run: | | |
| if [[ -z "${NUGET_KEY}" ]]; then | |
| echo "NUGET_API_KEY secret is required for tagged releases." >&2 | |
| exit 1 | |
| fi | |
| rid_pkgs="$( | |
| find artifacts -type f \ | |
| \( -name "pefix.linux-x64.*.nupkg" -o -name "pefix.osx-arm64.*.nupkg" -o -name "pefix.win-x64.*.nupkg" \) \ | |
| | sort | |
| )" | |
| root_pkgs="$(find artifacts -type f -name "pefix.[0-9]*.nupkg" | sort)" | |
| rid_count="$(printf '%s\n' "${rid_pkgs}" | sed '/^$/d' | wc -l | tr -d ' ')" | |
| root_count="$(printf '%s\n' "${root_pkgs}" | sed '/^$/d' | wc -l | tr -d ' ')" | |
| if [[ "${rid_count}" -ne 3 ]]; then | |
| echo "Expected 3 RID-specific NuGet packages, found ${rid_count}." >&2 | |
| printf '%s\n' "${rid_pkgs}" >&2 | |
| exit 1 | |
| fi | |
| if [[ "${root_count}" -ne 1 ]]; then | |
| echo "Expected 1 NuGet root package, found ${root_count}." >&2 | |
| printf '%s\n' "${root_pkgs}" >&2 | |
| exit 1 | |
| fi | |
| printf '%s\n' "${rid_pkgs}" | while IFS= read -r package; do | |
| dotnet nuget push "${package}" --api-key "${NUGET_KEY}" --source "https://api.nuget.org/v3/index.json" | |
| done | |
| dotnet nuget push "${root_pkgs}" --api-key "${NUGET_KEY}" --source "https://api.nuget.org/v3/index.json" | |
| - name: Release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| shell: bash | |
| run: | | |
| gh release create "${{ github.ref_name }}" \ | |
| --repo "${{ github.repository }}" \ | |
| --title "${{ github.ref_name }}" \ | |
| --notes "Run \`pefix --help\` for usage." \ | |
| artifacts/pefix-*.tar.gz artifacts/pefix-*.zip |