From 6c8c65976dae3d42444d72bae43ecd37321b38c0 Mon Sep 17 00:00:00 2001 From: "Shah, Ankur" Date: Mon, 22 Dec 2025 08:03:32 -0600 Subject: [PATCH 1/2] Updated to include the version as well as upload artifact --- .github/workflows/build.yml | 43 +++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 27e4fa1..93b517f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,9 +6,13 @@ name: .NET on: push: branches: [ "main" ] + tags: [ "v*" ] pull_request: branches: [ "main" ] +env: + VERSION: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') && github.ref_name || '0.0.0-local' }} + jobs: test: runs-on: ubuntu-latest @@ -21,7 +25,7 @@ jobs: - name: Restore run: dotnet restore - name: Build - run: dotnet build --no-restore -c Release + run: dotnet build --no-restore -c Release /p:Version=${{ env.VERSION }} - name: Test run: dotnet test -c Release --no-build --verbosity normal @@ -44,9 +48,44 @@ jobs: with: dotnet-version: 8.0.x - name: Publish self-contained single file - run: dotnet publish src/CsvToOfx.Cli/CsvToOfx.Cli.csproj -c Release -r ${{ matrix.rid }} --self-contained true /p:PublishSingleFile=true /p:IncludeAllContentForSelfExtract=true + run: dotnet publish src/CsvToOfx.Cli/CsvToOfx.Cli.csproj -c Release -r ${{ matrix.rid }} --self-contained true /p:PublishSingleFile=true /p:IncludeAllContentForSelfExtract=true /p:Version=${{ env.VERSION }} + - name: Archive artifact + if: ${{ runner.os != 'Windows' }} + run: | + cd src/CsvToOfx.Cli/bin/Release/net8.0/${{ matrix.rid }}/publish + zip -r ../../../../../../csv2ofx-${{ env.VERSION }}-${{ matrix.rid }}.zip . + - name: Archive artifact (Windows) + if: ${{ runner.os == 'Windows' }} + run: | + cd src\CsvToOfx.Cli\bin\Release\net8.0\${{ matrix.rid }}\publish + powershell -Command "Compress-Archive -Path * -DestinationPath ..\..\..\..\..\..\csv2ofx-${{ env.VERSION }}-${{ matrix.rid }}.zip" - name: Upload artifact uses: actions/upload-artifact@v4 with: name: csv2ofx-${{ matrix.rid }} path: src/CsvToOfx.Cli/bin/Release/net8.0/${{ matrix.rid }}/publish/ + - name: Upload release zip + uses: actions/upload-artifact@v4 + with: + name: csv2ofx-zip-${{ matrix.rid }} + path: src/CsvToOfx.Cli/bin/Release/net8.0/csv2ofx-${{ env.VERSION }}-${{ matrix.rid }}.zip + + release: + needs: publish + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v4 + with: + path: ./artifacts + - name: Create GitHub Release + uses: softprops/action-gh-release@v1 + with: + name: ${{ github.ref_name }} + tag_name: ${{ github.ref_name }} + files: | + artifacts/csv2ofx-zip-linux-x64/csv2ofx-${{ env.VERSION }}-linux-x64.zip + artifacts/csv2ofx-zip-osx-x64/csv2ofx-${{ env.VERSION }}-osx-x64.zip + artifacts/csv2ofx-zip-win-x64/csv2ofx-${{ env.VERSION }}-win-x64.zip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 5ae96cfdc8bbd2e6d7de3d84932806abdf756ee8 Mon Sep 17 00:00:00 2001 From: "Shah, Ankur" Date: Mon, 22 Dec 2025 08:09:29 -0600 Subject: [PATCH 2/2] Updated config to only use ubuntu-lates --- .github/workflows/build.yml | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 93b517f..9002af7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,16 +31,10 @@ jobs: publish: needs: test - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest strategy: matrix: - include: - - os: ubuntu-latest - rid: linux-x64 - - os: macos-latest - rid: osx-x64 - - os: windows-latest - rid: win-x64 + rid: [ linux-x64, osx-x64, win-x64 ] steps: - uses: actions/checkout@v4 - name: Setup .NET @@ -50,15 +44,9 @@ jobs: - name: Publish self-contained single file run: dotnet publish src/CsvToOfx.Cli/CsvToOfx.Cli.csproj -c Release -r ${{ matrix.rid }} --self-contained true /p:PublishSingleFile=true /p:IncludeAllContentForSelfExtract=true /p:Version=${{ env.VERSION }} - name: Archive artifact - if: ${{ runner.os != 'Windows' }} run: | cd src/CsvToOfx.Cli/bin/Release/net8.0/${{ matrix.rid }}/publish - zip -r ../../../../../../csv2ofx-${{ env.VERSION }}-${{ matrix.rid }}.zip . - - name: Archive artifact (Windows) - if: ${{ runner.os == 'Windows' }} - run: | - cd src\CsvToOfx.Cli\bin\Release\net8.0\${{ matrix.rid }}\publish - powershell -Command "Compress-Archive -Path * -DestinationPath ..\..\..\..\..\..\csv2ofx-${{ env.VERSION }}-${{ matrix.rid }}.zip" + zip -r ../../csv2ofx-${{ env.VERSION }}-${{ matrix.rid }}.zip . - name: Upload artifact uses: actions/upload-artifact@v4 with: