0.1.2 #39
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: CI/CD | |
| on: | |
| push: | |
| branches: [ main, master, 'claude/**' ] | |
| pull_request: | |
| branches: [ main, master ] | |
| release: | |
| types: [ published ] | |
| env: | |
| DOTNET_VERSION: '10.0.x' | |
| DOTNET_NOLOGO: true | |
| DOTNET_CLI_TELEMETRY_OPTOUT: true | |
| jobs: | |
| build: | |
| name: Build and Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Restore dependencies | |
| run: dotnet restore FindMyContacts.sln | |
| - name: Build | |
| run: dotnet build FindMyContacts.sln --configuration Release --no-restore | |
| - name: Run tests | |
| run: dotnet test FindMyContacts.sln --configuration Release --no-build --verbosity normal --logger trx --results-directory TestResults | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-results | |
| path: TestResults/*.trx | |
| package: | |
| name: Package ${{ matrix.name }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.event_name == 'release' | |
| strategy: | |
| matrix: | |
| include: | |
| - runtime: win-x64 | |
| name: Windows x64 | |
| extension: zip | |
| - runtime: win-arm64 | |
| name: Windows ARM64 | |
| extension: zip | |
| - runtime: linux-x64 | |
| name: Linux x64 | |
| extension: tar.gz | |
| - runtime: linux-arm64 | |
| name: Linux ARM64 | |
| extension: tar.gz | |
| - runtime: osx-arm64 | |
| name: macOS ARM64 | |
| extension: tar.gz | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Get version from release tag | |
| id: version | |
| run: | | |
| # Extract version from release tag (remove 'v' prefix if present) | |
| VERSION="${{ github.event.release.tag_name }}" | |
| VERSION="${VERSION#v}" | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Building version: $VERSION" | |
| - name: Restore dependencies | |
| run: dotnet restore src/FindMyContacts/FindMyContacts.csproj | |
| - name: Publish for ${{ matrix.name }} | |
| run: | | |
| dotnet publish src/FindMyContacts/FindMyContacts.csproj \ | |
| --configuration Release \ | |
| --runtime ${{ matrix.runtime }} \ | |
| --self-contained true \ | |
| --output ./publish/${{ matrix.runtime }} \ | |
| -p:PublishSingleFile=true \ | |
| -p:EnableCompressionInSingleFile=true \ | |
| -p:IncludeNativeLibrariesForSelfExtract=true \ | |
| -p:Version=${{ steps.version.outputs.version }} \ | |
| -p:AssemblyVersion=${{ steps.version.outputs.version }} \ | |
| -p:FileVersion=${{ steps.version.outputs.version }} \ | |
| -p:InformationalVersion=${{ steps.version.outputs.version }} | |
| - name: Create archive | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| cd ./publish/${{ matrix.runtime }} | |
| if [[ "${{ matrix.runtime }}" == win-* ]]; then | |
| zip -r "../../FindMyContacts-${VERSION}-${{ matrix.runtime }}.zip" . | |
| else | |
| tar -czvf "../../FindMyContacts-${VERSION}-${{ matrix.runtime }}.tar.gz" . | |
| fi | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: FindMyContacts-${{ steps.version.outputs.version }}-${{ matrix.runtime }} | |
| path: FindMyContacts-${{ steps.version.outputs.version }}-${{ matrix.runtime }}.${{ matrix.extension }} | |
| retention-days: 30 | |
| release: | |
| name: Upload Release Assets | |
| runs-on: ubuntu-latest | |
| needs: [build, package] | |
| if: github.event_name == 'release' | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Get version from release tag | |
| id: version | |
| run: | | |
| VERSION="${{ github.event.release.tag_name }}" | |
| VERSION="${VERSION#v}" | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| pattern: FindMyContacts-${{ steps.version.outputs.version }}-* | |
| merge-multiple: true | |
| - name: List artifacts | |
| run: | | |
| echo "Downloaded artifacts:" | |
| find artifacts -type f -name "*.zip" -o -name "*.tar.gz" | sort | |
| - name: Upload release assets to GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| artifacts/*.zip | |
| artifacts/*.tar.gz | |
| fail_on_unmatched_files: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |