From 6abeedb5b4f6505c2e0f1829a09d0ca5d838c308 Mon Sep 17 00:00:00 2001 From: bitcookies Date: Sat, 21 Mar 2026 21:55:14 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20Supports=20ver4=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/keygen.yml | 87 ++------------------------ .github/workflows/keygen_secrets.yml | 91 ++-------------------------- 2 files changed, 10 insertions(+), 168 deletions(-) diff --git a/.github/workflows/keygen.yml b/.github/workflows/keygen.yml index dd0cdbc..5466821 100644 --- a/.github/workflows/keygen.yml +++ b/.github/workflows/keygen.yml @@ -20,54 +20,22 @@ on: required: true jobs: - keygen-ascii: - name: Generating ASCII License + keygen: + name: Generating License (${{ github.event.inputs.KEY_ENCODING }}) runs-on: windows-2022 env: KEY_ENCODING: ${{ github.event.inputs.KEY_ENCODING }} KEY_USERNAME: ${{ github.event.inputs.KEY_USERNAME }} KEY_LICENSE_NAME: ${{ github.event.inputs.KEY_LICENSE_NAME }} - if: github.event.inputs.KEY_ENCODING == 'ascii' steps: - uses: actions/checkout@v6.0.2 - - name: Generating License (ASCII) - # Use PowerShell 5 - shell: powershell - run: | - $OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding - $PSVersionTable.PSVersion - bin/x64-Release/winrar-keygen.exe "${{ env.KEY_USERNAME }}" "${{ env.KEY_LICENSE_NAME }}" | Out-File -Encoding ${{ env.KEY_ENCODING }} rarreg.key - - - name: Uploading License - uses: actions/upload-artifact@v6.0.0 - with: - name: rarreg_file_${{ env.KEY_ENCODING }} - path: rarreg.key - if-no-files-found: error - retention-days: 90 - - - keygen-ansi: - name: Generating ANSI License - runs-on: windows-2022 - env: - KEY_ENCODING: ${{ github.event.inputs.KEY_ENCODING }} - KEY_USERNAME: ${{ github.event.inputs.KEY_USERNAME }} - KEY_LICENSE_NAME: ${{ github.event.inputs.KEY_LICENSE_NAME }} - if: github.event.inputs.KEY_ENCODING == 'ansi' - - steps: - - uses: actions/checkout@v6.0.2 - - - name: Generating License (ANSI) - # Use PowerShell 7 + - name: Generating License shell: pwsh run: | - [System.Text.Encoding]::Default - $OutputEncoding - bin/x64-Release/winrar-keygen.exe "${{ env.KEY_USERNAME }}" "${{ env.KEY_LICENSE_NAME }}" | Out-File -Encoding ${{ env.KEY_ENCODING }} rarreg.key + bin/x64-Release/winrar-keygen.exe "${{ env.KEY_USERNAME }}" "${{ env.KEY_LICENSE_NAME }}" -e ${{ env.KEY_ENCODING }} + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - name: Uploading License uses: actions/upload-artifact@v6.0.0 @@ -76,48 +44,3 @@ jobs: path: rarreg.key if-no-files-found: error retention-days: 90 - - - keygen-uft8: - name: Generating UTF8 License - runs-on: windows-2022 - env: - KEY_ENCODING: ${{ github.event.inputs.KEY_ENCODING }} - KEY_USERNAME: ${{ github.event.inputs.KEY_USERNAME }} - KEY_LICENSE_NAME: ${{ github.event.inputs.KEY_LICENSE_NAME }} - if: github.event.inputs.KEY_ENCODING == 'utf8' - - steps: - - uses: actions/checkout@v6.0.2 - - - name: Generating License (UTF-8) - # Use PowerShell 7 - shell: pwsh - run: | - $OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding - $PSVersionTable.PSVersion - $user = "utf8:${{ env.KEY_USERNAME }}" - $license = "${{ env.KEY_LICENSE_NAME }}" - - $allAscii = $true - foreach ($c in $license.ToCharArray()) { - if ([int][char]$c -gt 127) { - $allAscii = $false - break - } - } - - if (-not $allAscii) { - $license = "utf8:" + $license - } - - Write-Host "License string: $license" - bin/x64-Release/winrar-keygen.exe "$user" "$license" | Out-File -Encoding utf8NoBOM rarreg.key - - - name: Uploading License - uses: actions/upload-artifact@v6.0.0 - with: - name: rarreg_file_${{ env.KEY_ENCODING }} - path: rarreg.key - if-no-files-found: error - retention-days: 90 diff --git a/.github/workflows/keygen_secrets.yml b/.github/workflows/keygen_secrets.yml index 5b82ab2..e953503 100644 --- a/.github/workflows/keygen_secrets.yml +++ b/.github/workflows/keygen_secrets.yml @@ -9,57 +9,23 @@ on: required: true jobs: - keygen-ascii: - name: Generating ASCII License + keygen: + name: Generating License (${{ github.event.inputs.KEY_ENCODING }}) runs-on: windows-2022 env: KEY_ENCODING: ${{ github.event.inputs.KEY_ENCODING }} KEY_USERNAME: ${{ secrets.TEXT1 }} KEY_LICENSE_NAME: ${{ secrets.TEXT2 }} ZIP_PWD: ${{ secrets.PWD }} - if: github.event.inputs.KEY_ENCODING == 'ascii' steps: - uses: actions/checkout@v6.0.2 - - name: Generating License (ASCII) - # Use PowerShell 5 - shell: powershell - run: | - $OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding - $PSVersionTable.PSVersion - bin/x64-Release/winrar-keygen.exe "${{ env.KEY_USERNAME }}" "${{ env.KEY_LICENSE_NAME }}" | Out-File -Encoding ${{ env.KEY_ENCODING }} rarreg.key - 7z a rarreg.7z rarreg.key -p"${{ env.ZIP_PWD }}" - - - name: Uploading License - uses: actions/upload-artifact@v6.0.0 - with: - name: rarreg_file_${{ env.KEY_ENCODING }} - path: rarreg.7z - if-no-files-found: error - retention-days: 1 - - - keygen-ansi: - name: Generating ANSI License - runs-on: windows-2022 - env: - KEY_ENCODING: ${{ github.event.inputs.KEY_ENCODING }} - KEY_USERNAME: ${{ secrets.TEXT1 }} - KEY_LICENSE_NAME: ${{ secrets.TEXT2 }} - ZIP_PWD: ${{ secrets.PWD }} - if: github.event.inputs.KEY_ENCODING == 'ansi' - - steps: - - uses: actions/checkout@v6.0.2 - - - name: Generating License (ANSI) - # Use PowerShell 7 + - name: Generating License shell: pwsh run: | - [System.Text.Encoding]::Default - $OutputEncoding - bin/x64-Release/winrar-keygen.exe "${{ env.KEY_USERNAME }}" "${{ env.KEY_LICENSE_NAME }}" | Out-File -Encoding ${{ env.KEY_ENCODING }} rarreg.key + bin/x64-Release/winrar-keygen.exe "${{ env.KEY_USERNAME }}" "${{ env.KEY_LICENSE_NAME }}" -e ${{ env.KEY_ENCODING }} + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } 7z a rarreg.7z rarreg.key -p"${{ env.ZIP_PWD }}" - name: Uploading License @@ -69,50 +35,3 @@ jobs: path: rarreg.7z if-no-files-found: error retention-days: 1 - - - keygen-uft8: - name: Generating UTF8 License - runs-on: windows-2022 - env: - KEY_ENCODING: ${{ github.event.inputs.KEY_ENCODING }} - KEY_USERNAME: ${{ secrets.TEXT1 }} - KEY_LICENSE_NAME: ${{ secrets.TEXT2 }} - ZIP_PWD: ${{ secrets.PWD }} - if: github.event.inputs.KEY_ENCODING == 'utf8' - - steps: - - uses: actions/checkout@v6.0.2 - - - name: Generating License (UTF-8) - # Use PowerShell 7 - shell: pwsh - run: | - $OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding - $PSVersionTable.PSVersion - $user = "utf8:${{ env.KEY_USERNAME }}" - $license = "${{ env.KEY_LICENSE_NAME }}" - - $allAscii = $true - foreach ($c in $license.ToCharArray()) { - if ([int][char]$c -gt 127) { - $allAscii = $false - break - } - } - - if (-not $allAscii) { - $license = "utf8:" + $license - } - - Write-Host "Final license: $license" - bin/x64-Release/winrar-keygen.exe "$user" "$license" | Out-File -Encoding utf8NoBOM rarreg.key - 7z a rarreg.7z rarreg.key -p"${{ env.ZIP_PWD }}" - - - name: Uploading License - uses: actions/upload-artifact@v6.0.0 - with: - name: rarreg_file_${{ env.KEY_ENCODING }} - path: rarreg.7z - if-no-files-found: error - retention-days: 1