#---------------------------------# # general configuration # #---------------------------------# name: Build Cmder # Controls when the action will run. Triggers the workflow on push or pull request events but only for the main branch on: push: branches: [ "master" ] tags: - "v*" pull_request: branches: [ "master", "development" ] #---------------------------------# # environment configuration # #---------------------------------# env: # Path to the root of the Cmder project. CMDER_ROOT: ${{ github.workspace }} permissions: contents: read # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: build: name: Build Project runs-on: windows-latest permissions: contents: write discussions: write steps: - name: Check out repository code (Action from GitHub) uses: actions/checkout@v6 with: fetch-depth: 0 - name: Summary - Repository checkout shell: pwsh run: | # Get Cmder version . scripts/utils.ps1 $cmderVersion = Get-VersionStr @" ## 📦 Build Cmder - Workflow Summary ### Repository Information | Property | Value | | --- | --- | | Repository | ``${{ github.repository }}`` | | Branch | ``${{ github.ref_name }}`` | | Commit | ``${{ github.sha }}`` | | Actor | @${{ github.actor }} | | Workflow | ``${{ github.workflow }}`` | | Cmder Version | **$cmderVersion** | "@ | Add-Content -Path $env:GITHUB_STEP_SUMMARY -Encoding utf8 - name: Add MSBuild to PATH uses: microsoft/setup-msbuild@v2 - name: Build Cmder Launcher shell: pwsh working-directory: scripts run: .\build.ps1 -Compile -verbose - name: Summary - Build completed if: success() shell: pwsh run: | @" ### ✅ Build Status Cmder launcher successfully compiled. "@ | Add-Content -Path $env:GITHUB_STEP_SUMMARY -Encoding utf8 - name: Pack the built files shell: pwsh working-directory: scripts run: .\pack.ps1 -verbose - name: Summary - Package artifacts if: success() shell: pwsh run: | $summary = @" ### 📦 Artifacts Created | Artifact | Size | Hash (SHA256) | | --- | --- | --- | "@ $artifacts = @("cmder.zip", "cmder.7z", "cmder_mini.zip") foreach ($artifact in $artifacts) { $path = "build/$artifact" if (Test-Path $path) { $size = (Get-Item $path).Length / 1MB # Truncate hash to first 16 chars for summary readability (full hash in hashes.txt) $hash = (Get-FileHash $path -Algorithm SHA256).Hash.Substring(0, 16) $summary += "`n| ``$artifact`` | $([math]::Round($size, 2)) MB | ``$hash...`` |" } } $summary += "`n" $summary | Add-Content -Path $env:GITHUB_STEP_SUMMARY -Encoding utf8 - name: Upload artifact (cmder.zip) uses: actions/upload-artifact@v5 with: path: build/cmder.zip name: cmder.zip if-no-files-found: error - name: Upload artifact (cmder.7z) uses: actions/upload-artifact@v5 with: path: build/cmder.7z name: cmder.7z - name: Upload artifact (cmder_mini.zip) uses: actions/upload-artifact@v5 with: path: build/cmder_mini.zip name: cmder_mini.zip - name: Upload artifact (hashes.txt) uses: actions/upload-artifact@v5 with: path: build/hashes.txt name: hashes.txt - name: Summary - Artifacts uploaded if: success() shell: pwsh run: | @" ### ☁️ Upload Status All artifacts successfully uploaded to GitHub Actions: - ✅ ``cmder.zip`` - ✅ ``cmder.7z`` - ✅ ``cmder_mini.zip`` - ✅ ``hashes.txt`` "@ | Add-Content -Path $env:GITHUB_STEP_SUMMARY -Encoding utf8 - name: Create Release uses: softprops/action-gh-release@v2 with: files: | build/cmder.zip build/cmder.7z build/cmder_mini.zip build/hashes.txt draft: true generate_release_notes: true if: startsWith(github.ref, 'refs/tags/') - name: Summary - Release created if: startsWith(github.ref, 'refs/tags/') shell: pwsh run: | @" ### 🚀 Release Information Draft release created for tag: **``${{ github.ref_name }}``** Release includes: - Full version (``cmder.zip``, ``cmder.7z``) - Mini version (``cmder_mini.zip``) - File hashes (``hashes.txt``) > ⚠️ Release is in **draft** mode. Please review and publish manually. "@ | Add-Content -Path $env:GITHUB_STEP_SUMMARY -Encoding utf8