diff --git a/.github/workflows/auto-pr-from-main.yml b/.github/workflows/auto-pr-from-main.yml index d8b3fb9..7b4b412 100644 --- a/.github/workflows/auto-pr-from-main.yml +++ b/.github/workflows/auto-pr-from-main.yml @@ -29,7 +29,7 @@ jobs: - name: ๐Ÿ—„๏ธ Setup .NET uses: actions/setup-dotnet@v5 with: - dotnet-version: "8.0.x" + dotnet-version: "10.0.x" - name: ๏ฟฝ Check for NuGet Updates run: | @@ -147,7 +147,7 @@ jobs: - name: ๏ฟฝ๏ธ Setup .NET uses: actions/setup-dotnet@v5 with: - dotnet-version: "8.0.x" + dotnet-version: "10.0.x" - name: ๐Ÿ”’ Check for Security Updates run: | diff --git a/.github/workflows/ci-build-test.yml b/.github/workflows/ci-build-test.yml index 3ccbaa8..89f30e6 100644 --- a/.github/workflows/ci-build-test.yml +++ b/.github/workflows/ci-build-test.yml @@ -12,12 +12,12 @@ on: types: [opened, synchronize, reopened, closed] env: - DOTNET_VERSION: "8.0.x" + DOTNET_VERSION: "10.0.x" jobs: # Build QRCoder.Core build-qrcoder: - name: Build QRCoder.Core (.NET 8) + name: Build QRCoder.Core (.NET 10) runs-on: ubuntu-latest steps: @@ -63,7 +63,7 @@ jobs: --results-directory TestResults \ --collect:"XPlat Code Coverage" \ --verbosity normal \ - --framework net8.0 + --framework net10.0 - name: Upload Test Results uses: actions/upload-artifact@v4 diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index bdc8bad..9adafd1 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -61,7 +61,7 @@ jobs: - name: ๐Ÿ—„๏ธ Setup .NET uses: actions/setup-dotnet@v5 with: - dotnet-version: "8.0.x" + dotnet-version: "10.0.x" - name: โ˜• Set up JDK 17 uses: actions/setup-java@v5 @@ -124,7 +124,7 @@ jobs: - name: ๐Ÿ—„๏ธ Setup .NET uses: actions/setup-dotnet@v5 with: - dotnet-version: "8.0.x" + dotnet-version: "10.0.x" - name: ๐Ÿ”ง Restore Dependencies run: dotnet restore MetarDecoder.sln --ignore-failed-sources @@ -203,7 +203,7 @@ jobs: - name: ๐Ÿ—„๏ธ Setup .NET uses: actions/setup-dotnet@v5 with: - dotnet-version: "8.0.x" + dotnet-version: "10.0.x" - name: ๐Ÿ”ง Restore Dependencies run: dotnet restore MetarDecoder.sln --ignore-failed-sources diff --git a/.github/workflows/publish-all.yml b/.github/workflows/publish-all.yml index 2697edd..71bd561 100644 --- a/.github/workflows/publish-all.yml +++ b/.github/workflows/publish-all.yml @@ -1,21 +1,31 @@ name: ๐Ÿš€ Publish NuGet Packages on: + push: + tags: + - "v*" workflow_dispatch: inputs: + version: + description: "Version to publish (e.g., 1.0.0)" + required: false + default: "1.0.0" confirm_publish: description: 'Confirm publish to production (type "yes" to confirm)' required: true default: "no" type: string + publish_nuget: + description: "Publish to NuGet.org" + required: true + default: true + type: boolean release: types: [published] - push: - tags: - - "v*" env: BUILD_CONFIG: "Release" + DOTNET_VERSION: "10.0.x" NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS: "30" NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS: "30" @@ -27,7 +37,29 @@ jobs: if: github.event.inputs.confirm_publish == 'yes' || github.event_name == 'release' || startsWith(github.ref, 'refs/tags/v') steps: - - name: ๐Ÿ” Check CI/CD Status + - name: ๏ฟฝ Checkout + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: ๐Ÿ—„๏ธ Setup .NET + uses: actions/setup-dotnet@v5 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + + - name: ๐Ÿ”ง Restore Dependencies + run: dotnet restore QRCoder.Core.sln --ignore-failed-sources + + - name: ๐Ÿงช Run Tests + run: | + echo "๐Ÿงช Running tests before publish..." + dotnet test QRCoder.Core.Tests/ \ + --configuration ${{ env.BUILD_CONFIG }} \ + --logger "trx;LogFileName=test-results.trx" \ + --results-directory TestResults \ + --verbosity normal + + - name: ๏ฟฝ Check CI/CD Status run: | echo "๐Ÿ” Validating CI/CD status before publish..." echo "โœ… CI/CD validation completed" @@ -53,46 +85,66 @@ jobs: - name: ๐Ÿ“ฅ Checkout uses: actions/checkout@v6 - - name: ๐Ÿ“ฆ Setup NuGet - uses: NuGet/setup-nuget@v2.0.1 - - - name: ๐Ÿ—„๏ธ Setup .NET + - name: ๏ธ Setup .NET uses: actions/setup-dotnet@v5 with: - dotnet-version: "8.0.x" + dotnet-version: ${{ env.DOTNET_VERSION }} - name: ๐Ÿ”ง Clear NuGet cache run: dotnet nuget locals all --clear + - name: ๐Ÿ”ง Restore Dependencies + run: dotnet restore QRCoder.Core.sln --ignore-failed-sources + - name: ๐Ÿ—๏ธ Build Solution - run: dotnet build MetarDecoder.sln --configuration ${{ env.BUILD_CONFIG }} --verbosity normal + run: dotnet build QRCoder.Core.sln --configuration ${{ env.BUILD_CONFIG }} --verbosity normal - name: ๐Ÿ“ฆ Pack NuGet - run: dotnet pack MetarDecoder.sln --configuration ${{ env.BUILD_CONFIG }} /p:ContinuousIntegrationBuild=true --output ./packages + run: | + if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then + VERSION="${{ github.event.inputs.version }}" + echo "Building version $VERSION from workflow_dispatch" + dotnet pack QRCoder.Core/QRCoder.Core.csproj \ + --configuration ${{ env.BUILD_CONFIG }} \ + --no-build \ + --output ./packages \ + -p:Version=$VERSION \ + -p:PackageReleaseNotes="Release version $VERSION" + else + # Extract version from tag + VERSION=$(echo ${{ github.ref_name }} | sed 's/^v//') + echo "Building version $VERSION from tag" + dotnet pack QRCoder.Core/QRCoder.Core.csproj \ + --configuration ${{ env.BUILD_CONFIG }} \ + --no-build \ + --output ./packages \ + -p:Version=$VERSION \ + -p:PackageReleaseNotes="Release version $VERSION" + fi - name: ๐Ÿ“ฆ Publish to GitHub Packages run: | echo "๐Ÿ“ฆ Publishing to GitHub Packages..." dotnet nuget push ./packages/*.nupkg \ - --source 'https://nuget.pkg.github.com/afonsoft/index.json' \ + --source 'https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json' \ --api-key ${{ secrets.GITHUB_TOKEN }} \ --skip-duplicate - name: ๐Ÿ“ฆ Publish to NuGet.org + if: ${{ github.event.inputs.publish_nuget != 'false' }} run: | echo "๐Ÿ“ฆ Publishing to NuGet.org..." dotnet nuget push ./packages/*.nupkg \ --source 'https://api.nuget.org/v3/index.json' \ - --api-key ${{ secrets.NUGET_TOKEN }} \ + --api-key ${{ secrets.NUGET_API_KEY }} \ --skip-duplicate - name: โœ… NuGet Summary run: | echo "๐Ÿ“ฆ NuGet packages published successfully!" echo "๐Ÿ“Š Available at:" - echo " - GitHub Packages: https://github.com/afonsoft/metar-decoder/packages" - echo " - NuGet.org: https://www.nuget.org/packages?q=Metar.Decoder" - echo " - NuGet.org: https://www.nuget.org/packages?q=Taf.Decoder" + echo " - GitHub Packages: https://github.com/${{ github.repository }}/packages" + echo " - NuGet.org: https://www.nuget.org/packages/QRCoder.Core" - name: ๏ฟฝ Upload Package Artifacts uses: actions/upload-artifact@v4 @@ -104,33 +156,39 @@ jobs: # Create GitHub Release create-release: - name: ๐ŸŽ‰ Create GitHub Release + name: ๏ฟฝ๏ธ Create GitHub Release runs-on: ubuntu-latest needs: [validate-publish, publish-nuget] if: startsWith(github.ref, 'refs/tags/v') && github.event_name == 'push' steps: - - name: ๏ฟฝ Checkout + - name: ๐Ÿ“ฅ Checkout uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: ๐Ÿ“ฅ Download Package Artifacts + uses: actions/download-artifact@v4 + with: + name: nuget-packages + path: ./packages - - name: ๐ŸŽ‰ Create Release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: ๐Ÿท๏ธ Create GitHub Release + uses: softprops/action-gh-release@v2 with: tag_name: ${{ github.ref_name }} - release_name: "Release ${{ github.ref_name }}" + name: Release ${{ github.ref_name }} body: | ## ๐ŸŽ‰ Release ${{ github.ref_name }} - ### ๏ฟฝ NuGet Packages - - **Metar.Decoder**: Available on NuGet.org - - **Taf.Decoder**: Available on NuGet.org + ### ๐Ÿ“ฆ Package Information + - **Version**: ${{ github.ref_name }} + - **Commit**: ${{ github.sha }} + - **Build**: [View Workflow Run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) - ### ๏ฟฝ Changes - - Automated release from main branch - - All tests passing - - Code quality checks passed + ### ๐Ÿ“ฆ Installation + ```bash + dotnet add package QRCoder.Core --version ${{ github.ref_name }} ### ๐Ÿ“ฅ Installation ```shell @@ -163,6 +221,5 @@ jobs: echo "**๐ŸŽฏ All publish jobs completed!**" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "### ๐Ÿ“ฆ Package Links" >> $GITHUB_STEP_SUMMARY - echo "- **Metar.Decoder**: [NuGet.org](https://www.nuget.org/packages/Metar.Decoder)" >> $GITHUB_STEP_SUMMARY - echo "- **Taf.Decoder**: [NuGet.org](https://www.nuget.org/packages/Taf.Decoder)" >> $GITHUB_STEP_SUMMARY - echo "- **GitHub Packages**: [View Packages](https://github.com/afonsoft/metar-decoder/packages)" >> $GITHUB_STEP_SUMMARY + echo "- **QRCoder.Core**: [NuGet.org](https://www.nuget.org/packages/QRCoder.Core)" >> $GITHUB_STEP_SUMMARY + echo "- **GitHub Packages**: [View Packages](https://github.com/${{ github.repository }}/packages)" >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml deleted file mode 100644 index 84953b7..0000000 --- a/.github/workflows/publish-nuget.yml +++ /dev/null @@ -1,196 +0,0 @@ -name: ๐Ÿ“ฆ Publish NuGet - -on: - push: - tags: - - "v*" - workflow_dispatch: - inputs: - version: - description: "Version to publish (e.g., 1.0.0)" - required: true - default: "1.0.0" - publish_nuget: - description: "Publish to NuGet.org" - required: true - default: true - type: boolean - -env: - DOTNET_VERSION: "8.0.x" - -jobs: - # Build and Test - build-and-test: - name: ๐Ÿ”จ Build & Test - runs-on: ubuntu-latest - - steps: - - name: ๐Ÿ“ฅ Checkout Code - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: ๐Ÿ—„๏ธ Setup .NET - uses: actions/setup-dotnet@v5 - with: - dotnet-version: ${{ env.DOTNET_VERSION }} - - - name: ๐Ÿ”ง Restore Dependencies - run: dotnet restore QRCoder.Core.sln - - - name: ๐Ÿ”จ Build Solution - run: dotnet build QRCoder.Core.sln --configuration Release --no-restore - - - name: ๐Ÿงช Run Tests - run: dotnet test QRCoder.Core.Tests/ --configuration Release --no-build --verbosity normal - - # Publish to NuGet - publish: - name: ๐Ÿ“ฆ Publish to NuGet - runs-on: ubuntu-latest - needs: build-and-test - if: | - (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) || - (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_nuget == 'true') - - steps: - - name: ๐Ÿ“ฅ Checkout Code - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: ๐Ÿ—„๏ธ Setup .NET - uses: actions/setup-dotnet@v5 - with: - dotnet-version: ${{ env.DOTNET_VERSION }} - - - name: ๐Ÿ”ง Restore Dependencies - run: dotnet restore QRCoder.Core.sln - - - name: ๐Ÿ”จ Build Solution - run: dotnet build QRCoder.Core.sln --configuration Release --no-restore - - - name: ๐Ÿ“ฆ Pack NuGet Package - run: | - if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then - VERSION="${{ github.event.inputs.version }}" - echo "Building version $VERSION from workflow_dispatch" - dotnet pack QRCoder.Core/QRCoder.Core.csproj \ - --configuration Release \ - --no-build \ - --output ./nupkg \ - -p:Version=$VERSION \ - -p:PackageReleaseNotes="Release version $VERSION" - else - # Extract version from tag - VERSION=$(echo ${{ github.ref_name }} | sed 's/^v//') - echo "Building version $VERSION from tag" - dotnet pack QRCoder.Core/QRCoder.Core.csproj \ - --configuration Release \ - --no-build \ - --output ./nupkg \ - -p:Version=$VERSION \ - -p:PackageReleaseNotes="Release version $VERSION" - fi - - - name: ๐Ÿ“ค Upload Package Artifacts - uses: actions/upload-artifact@v4 - with: - name: nuget-packages - path: ./nupkg/*.nupkg - retention-days: 30 - - - name: ๐Ÿ“ฆ Publish to NuGet.org - run: | - echo "๐Ÿ“ฆ Publishing to NuGet.org" - dotnet nuget push ./nupkg/*.nupkg \ - --api-key ${{ secrets.NUGET_API_KEY }} \ - --source https://api.nuget.org/v3/index.json \ - --skip-duplicate \ - --no-symbols - - - name: ๐Ÿ“ฆ Publish to GitHub Packages - run: | - echo "๐Ÿ“ฆ Publishing to GitHub Packages" - dotnet nuget push ./nupkg/*.nupkg \ - --api-key ${{ secrets.GITHUB_TOKEN }} \ - --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json \ - --skip-duplicate \ - --no-symbols - - - name: ๐Ÿ“Š Generate Release Summary - run: | - echo "## ๐Ÿ“ฆ NuGet Publishing Summary" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "### ๐ŸŽฏ Published Version" >> $GITHUB_STEP_SUMMARY - if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then - echo "- **Version**: ${{ github.event.inputs.version }}" >> $GITHUB_STEP_SUMMARY - else - echo "- **Version**: $(echo ${{ github.ref_name }} | sed 's/^v//')" >> $GITHUB_STEP_SUMMARY - fi - echo "- **Source**: ${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY - echo "- **Commit**: ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "### ๐Ÿ“ฆ Package Locations" >> $GITHUB_STEP_SUMMARY - echo "- **NuGet.org**: [QRCoder.Core](https://www.nuget.org/packages/QRCoder.Core)" >> $GITHUB_STEP_SUMMARY - echo "- **GitHub Packages**: [QRCoder.Core](https://github.com/${{ github.repository }}/pkgs/container/qrcoder-core)" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "### ๐Ÿ“‹ Artifacts" >> $GITHUB_STEP_SUMMARY - echo "- **NuGet Packages**: Available in artifacts" >> $GITHUB_STEP_SUMMARY - echo "- **Build Logs**: Available in workflow run" >> $GITHUB_STEP_SUMMARY - - # Create GitHub Release - create-release: - name: ๐Ÿท๏ธ Create Release - runs-on: ubuntu-latest - needs: publish - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') - - steps: - - name: ๐Ÿ“ฅ Checkout Code - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: ๐Ÿ“ฅ Download Package Artifacts - uses: actions/download-artifact@v4 - with: - name: nuget-packages - path: ./nupkg - - - name: ๐Ÿท๏ธ Create GitHub Release - uses: softprops/action-gh-release@v2 - with: - tag_name: ${{ github.ref_name }} - name: Release ${{ github.ref_name }} - body: | - ## ๐ŸŽ‰ Release ${{ github.ref_name }} - - ### ๐Ÿ“ฆ Package Information - - **Version**: ${{ github.ref_name }} - - **Commit**: ${{ github.sha }} - - **Build**: [View Workflow Run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - ### ๐Ÿ“ฆ Installation - ```bash - dotnet add package QRCoder.Core --version ${{ github.ref_name }} - ``` - - ### ๐Ÿ“‹ Changes - - - Updated CI/CD pipeline - - Improved test coverage - - Enhanced documentation - - ### ๐Ÿ”— Links - - **NuGet Package**: [QRCoder.Core on NuGet](https://www.nuget.org/packages/QRCoder.Core) - - **GitHub Packages**: [QRCoder.Core on GitHub](https://github.com/${{ github.repository }}/pkgs/container/qrcoder-core) - - **Documentation**: [README](https://github.com/${{ github.repository }}/blob/main/README.md) - - files: ./nupkg/*.nupkg - draft: false - prerelease: contains(github.ref, 'beta') || contains(github.ref, 'rc') || contains(github.ref, 'alpha') - generate_release_notes: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/security-scan.yml b/.github/workflows/security-scan.yml index 3efbe49..65bf84e 100644 --- a/.github/workflows/security-scan.yml +++ b/.github/workflows/security-scan.yml @@ -54,7 +54,7 @@ jobs: - name: ๐Ÿ—„๏ธ Setup .NET uses: actions/setup-dotnet@v5 with: - dotnet-version: "8.0.x" + dotnet-version: "10.0.x" - name: ๐Ÿ”ง Restore Dependencies run: dotnet restore MetarDecoder.sln --ignore-failed-sources @@ -89,7 +89,7 @@ jobs: - name: ๐Ÿ—„๏ธ Setup .NET uses: actions/setup-dotnet@v5 with: - dotnet-version: "8.0.x" + dotnet-version: "10.0.x" - name: โ˜• Set up JDK 17 uses: actions/setup-java@v5