🐍 Refresh PDCurses #7
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: 🐍 Refresh PDCurses | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 9 1 1-12 *" | |
| jobs: | |
| windows-x64: | |
| name: 🪟 Windows x64 | |
| runs-on: windows-2022 | |
| steps: | |
| - name: ☁️ Clone repository | |
| id: checkout-repository | |
| uses: actions/checkout@master | |
| with: | |
| repository: wmcbrine/PDCurses | |
| ref: refs/heads/master | |
| - name: ⚙️ Setup environment | |
| id: setup-environment | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| - name: 🛠️ Patch "curses.h" | |
| id: patch-curses | |
| shell: pwsh | |
| run: | | |
| $defines = @" | |
| #define PDC_DLL_BUILD 1 | |
| #define PDC_WIDE 1 | |
| #define PDC_RGB 1 | |
| "@ | |
| $content = Get-Content -Path "curses.h" -Raw | |
| $newContent = $defines + $content | |
| Set-Content -Path "curses.h" -Value $newContent | |
| - name: 🛠️ Build library | |
| id: build-library | |
| run: | | |
| cd wincon | |
| nmake WIDE=Y DLL=Y -f Makefile.vc | |
| ren pdcurses.dll libpdcurses-wincon-x64.dll | |
| - name: ⬆️ Upload artifacts | |
| id: upload-artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: libraries-windows-x64-wincon | |
| path: "wincon/libpdcurses-wincon-x64.dll" | |
| if-no-files-found: error | |
| create-pr: | |
| name: 📝 Create pull request | |
| runs-on: ubuntu-latest | |
| needs: [windows-x64] | |
| outputs: | |
| pr_created: ${{ steps.create-pull-request.outputs.pull-request-number != '' }} | |
| pr_number: ${{ steps.create-pull-request.outputs.pull-request-number }} | |
| files_changed: ${{ steps.check-changes.outputs.files_changed }} | |
| steps: | |
| - name: ☁️ Clone repository | |
| id: checkout-repository | |
| uses: actions/checkout@v4 | |
| - name: 📥 Download artifacts | |
| id: download-artifact | |
| uses: actions/download-artifact@v4.1.7 | |
| with: | |
| pattern: libraries* | |
| merge-multiple: true | |
| path: lib/pdcurses | |
| - name: 🔍 Check for changes | |
| id: check-changes | |
| run: | | |
| if git diff --quiet HEAD -- lib/pdcurses/; then | |
| echo "files_changed=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "files_changed=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: 🔼 Bump version | |
| id: bump-version | |
| if: steps.check-changes.outputs.files_changed == 'true' | |
| run: | | |
| VERSION=$(date +%Y.%m.%d) | |
| sed -i "s|<OverallVersion>.*</OverallVersion>|<OverallVersion>$VERSION</OverallVersion>|" NativeLibraries/Sharpie.NativeLibraries.PdCurses.csproj | |
| - name: 📝 Create pull request | |
| id: create-pull-request | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| commit-message: (chore) Update PDCurses native libraries. | |
| committer: Alexandru Ciobanu <alex+git[bot]@ciobanu.org> | |
| author: Alexandru Ciobanu <alex+git[bot]@ciobanu.org> | |
| title: Update PDCurses native library to latest master. | |
| body: This is an auto-generated PR with native library updates. | |
| delete-branch: true | |
| labels: dependencies | |
| assignees: pavkam | |
| branch: pdcurses-lib-update | |
| summary: | |
| name: ✔︎ Generate summary | |
| runs-on: ubuntu-latest | |
| needs: [windows-x64, create-pr] | |
| if: ${{ always() }} | |
| steps: | |
| - name: 📝 Create summary | |
| id: create-summary | |
| shell: bash | |
| run: | | |
| echo "## 🐍 PDCurses Library Build Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| Platform | Status | Library Changes |" >> $GITHUB_STEP_SUMMARY | |
| echo "|----------|--------|----------------|" >> $GITHUB_STEP_SUMMARY | |
| # Check build job status | |
| if [ "${{ needs.windows-x64.result }}" = "success" ]; then | |
| echo "| Windows x64 | ✅ Success |" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "| Windows x64 | ❌ Failed |" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### 📝 Pull Request Status" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| # Check if PR was created and files changed | |
| if [ "${{ needs.create-pr.outputs.pr_created }}" = "true" ]; then | |
| if [ "${{ needs.create-pr.outputs.files_changed }}" = "true" ]; then | |
| echo "| Status | 🔄 PR Created with Changes |" >> $GITHUB_STEP_SUMMARY | |
| echo "| PR Number | #${{ needs.create-pr.outputs.pr_number }} |" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "| Status | ⏭️ No Changes - No PR Created |" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| else | |
| echo "| Status | ❌ PR Creation Failed |" >> $GITHUB_STEP_SUMMARY | |
| fi |