From 1e718f3c24e313248b53743f659216f251a3efa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20Sander?= Date: Tue, 19 Mar 2024 12:37:09 +0000 Subject: [PATCH] build: Update to latest build tools --- .github/workflows/ci.yaml | 359 +++++++++++++++++ ...deql-analysis.yml => codeql-analysis.yaml} | 0 .github/workflows/release-please.yml | 372 ------------------ .../{virus-scan.yml => virus-scan.yaml} | 6 +- .gitignore | 2 + README.md | 4 +- release-please-config.json | 57 +-- 7 files changed, 400 insertions(+), 400 deletions(-) create mode 100644 .github/workflows/ci.yaml rename .github/workflows/{codeql-analysis.yml => codeql-analysis.yaml} (100%) delete mode 100644 .github/workflows/release-please.yml rename .github/workflows/{virus-scan.yml => virus-scan.yaml} (67%) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..89f6e19 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,359 @@ +name: ci-pipeline + +on: + workflow_dispatch: + push: + branches: + - main + +jobs: + release-please: + runs-on: ubuntu-latest + outputs: + releases_created: ${{ steps.release.outputs.releases_created }} + release_tag_name: ${{ steps.release.outputs.tag_name }} + release_upload_url: ${{ steps.release.outputs.upload_url }} + env: + GITHUB_REF: ${{ github.ref }} + GITHUB_TOKEN: ${{ secrets.PAT }} + DIST_FILE_NAME: qs-jwt + steps: + - name: Show github.ref + run: echo "$GITHUB_REF" + + - uses: google-github-actions/release-please-action@v4 + id: release + if: | + github.repository_owner == 'ptarmiganlabs' + with: + token: ${{ secrets.RELEASE_PLEASE_PAT }} + # optional. customize path to release-please-config.json + config-file: release-please-config.json + # optional. customize path to .release-please-manifest.json + manifest-file: .release-please-manifest.json + target-branch: main + + + - name: Show output from Release-Please + if: always() + env: + RELEASE_PLEASE_OUTPUT: ${{ toJSON(steps.release.outputs) }} + run: echo "$RELEASE_PLEASE_OUTPUT" + + - name: Show output from Release-Please + # if: ${{ steps.release.outputs.releases_created }} + run: | + echo "release_created : ${{ steps.release.outputs.release_created }}" + echo "releases_created: ${{ steps.release.outputs.releases_created }}" + echo "draft : ${{ steps.release.outputs['draft'] }}" + echo "path : ${{ steps.release.outputs['path'] }}" + echo "upload_url : ${{ steps.release.outputs['upload_url'] }}" + echo "html_url : ${{ steps.release.outputs['html_url'] }}" + echo "tag_name : ${{ steps.release.outputs['tag_name'] }}" + echo "version : ${{ steps.release.outputs['version'] }}" + echo "major : ${{ steps.release.outputs['major'] }}" + echo "minor : ${{ steps.release.outputs['minor'] }}" + echo "patch : ${{ steps.release.outputs['patch'] }}" + echo "sha : ${{ steps.release.outputs['sha'] }}" + + release-macos: + needs: release-please + runs-on: + - self-hosted + - x64 + - macos + - sp53 + # timeout-minutes: 15 + + if: needs.release-please.outputs.releases_created == 'true' + env: + DIST_FILE_NAME: qs-jwt + GITHUB_TOKEN: ${{ secrets.PAT }} + MACOS_CERTIFICATE: ${{ secrets.PROD_MACOS_CERTIFICATE_BASE64_CODESIGN }} + MACOS_CERTIFICATE_PWD: ${{ secrets.PROD_MACOS_CERTIFICATE_CODESIGN_PWD }} + MACOS_CERTIFICATE_NAME: ${{ secrets.PROD_MACOS_CERTIFICATE_CODESIGN_NAME }} + MACOS_CI_KEYCHAIN_PWD: ${{ secrets.PROD_MACOS_CI_KEYCHAIN_PWD }} + PROD_MACOS_NOTARIZATION_APPLE_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_APPLE_ID }} + PROD_MACOS_NOTARIZATION_TEAM_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_TEAM_ID }} + PROD_MACOS_NOTARIZATION_PWD: ${{ secrets.PROD_MACOS_NOTARIZATION_PWD }} + steps: + - name: Release tag and upload url from previous job + run: | + echo "tag_name : ${{ needs.release-please.outputs.release_tag_name }}" + echo "upload_url : ${{ needs.release-please.outputs.release_upload_url }}" + + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: Install tool for creating stand-alone executables + run: | + npm install pkg --location=global + npm install --save-exact esbuild + + - name: Install dependencies + run: | + pwd + npm ci --include=prod + + - name: Build binaries + run: | + pwd + ./node_modules/.bin/esbuild ./qs-jwt.js --bundle --outfile=qs-jwt.cjs --format=cjs --platform=node --target=node18 --minify + pkg --output "./${DIST_FILE_NAME}" -t node18-macos-x64 ./qs-jwt.cjs --config package.json --compress GZip + + chmod +x "${DIST_FILE_NAME}" + security delete-keychain build.keychain || true + + # Turn our base64-encoded certificate back to a regular .p12 file + echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12 + + # We need to create a new keychain, otherwise using the certificate will prompt + # with a UI dialog asking for the certificate password, which we can't + # use in a headless CI environment + + security create-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain + security list-keychains -d user -s build.keychain + security default-keychain -d user -s build.keychain + security unlock-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain + security import certificate.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PWD" -T /usr/bin/codesign + security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_CI_KEYCHAIN_PWD" build.keychain + + codesign --force -s "$MACOS_CERTIFICATE_NAME" -v "./${DIST_FILE_NAME}" --deep --strict --options=runtime --timestamp --entitlements ./release-config/${DIST_FILE_NAME}.entitlements + + # We can't notarize an app bundle directly, but we need to compress it as an archive. + # Therefore, we create a zip file containing our app bundle, so that we can send it to the + # notarization service + + # Notarize release binary + echo "Creating temp notarization archive for release binary" + zip -r "./${DIST_FILE_NAME}-${{ needs.release-please.outputs.release_tag_name }}-macos.zip" "./${DIST_FILE_NAME}" -x "*.DS_Store" + + # Add additional files to the zip file, if any + + # Here we send the notarization request to the Apple's Notarization service, waiting for the result. + # This typically takes a few seconds inside a CI environment, but it might take more depending on the App + # characteristics. Visit the Notarization docs for more information and strategies on how to optimize it if + # you're curious + echo "Notarize release app" + xcrun notarytool submit "./${DIST_FILE_NAME}-${{ needs.release-please.outputs.release_tag_name }}-macos.zip" --keychain-profile "notarytool-profile" --wait + + # Delete build keychain + security delete-keychain build.keychain + + - name: Upload to existing release + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + omitBodyDuringUpdate: true + omitNameDuringUpdate: true + artifactContentType: raw + # artifactContentType: application/zip + draft: true + tag: ${{ needs.release-please.outputs.release_tag_name }} + artifacts: ./qs-jwt-${{ needs.release-please.outputs.release_tag_name }}-macos.zip + token: ${{ github.token }} + + - name: Tidy up before existing + run: | + pwd + ls -la + rm qs-jwt.cjs + rm "./${DIST_FILE_NAME}" + rm "./${DIST_FILE_NAME}-${{ needs.release-please.outputs.release_tag_name }}-macos.zip" + + release-win64: + needs: release-please + runs-on: + - self-hosted + - x64 + - windows + - sp53 + - win-code-sign + # timeout-minutes: 15 + if: needs.release-please.outputs.releases_created == 'true' + env: + DIST_FILE_NAME: qs-jwt + GITHUB_TOKEN: ${{ secrets.PAT }} + CODESIGN_WIN_THUMBPRINT: ${{ secrets.WIN_CODESIGN_THUMBPRINT}} + steps: + - name: Release tag and upload url from previous job + run: | + Write-Output 'tag_name : ${{ needs.release-please.outputs.release_tag_name }}' + Write-Output 'upload_url : ${{ needs.release-please.outputs.release_upload_url }}' + + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: Install tool for creating stand-alone executables + run: | + npm install pkg --location=global + npm install --save-exact esbuild + + - name: Install dependencies + run: | + pwd + npm ci --include=prod + + - name: Build binaries + run: | + ./node_modules/.bin/esbuild ./qs-jwt.js --bundle --external:axios --external:xdg-open --external:enigma.js --outfile=qs-jwt.cjs --format=cjs --platform=node --target=node18 --minify + pkg --output "./${env:DIST_FILE_NAME}.exe" -t node18-win-x64 ./qs-jwt.cjs --config package.json --compress GZip + + # # Extract signing certificate to files on disk + # New-Item -ItemType directory -Path certificate + # Set-Content -Path certificate\certificate.txt -Value $env:CODESIGN_BASE64 + # certutil -decode certificate\certificate.txt certificate\certificate.pfx + # Set-Content -Path certificate\intermediate.txt -Value $env:CODESIGN_INTERMEDIATE_BASE64 + # certutil -decode certificate\intermediate.txt certificate\intermediate.crt + + # $processOptions = @{ + # FilePath = "C:\Program Files (x86)/Windows Kits/10/bin/10.0.22621.0/x64/signtool.exe" + # Wait = $true + # ArgumentList = "sign", "/fd", "SHA256", "/p", "$env:CODESIGN_PWD", "/ac", "certificate\intermediate.crt", "/f", "certificate\certificate.pfx", "/tr", "http://timestamp.sectigo.com/rfc3161", "/td", "sha256", "./${env:DIST_FILE_NAME}.exe" + # WorkingDirectory = "." + # NoNewWindow = $true + # } + # Start-Process @processOptions + + # Sign the executable + # 1st signing + $processOptions1 = @{ + FilePath = "C:\Program Files (x86)/Windows Kits/10/bin/10.0.22621.0/x64/signtool.exe" + Wait = $true + ArgumentList = "sign", "/sha1", "$env:CODESIGN_WIN_THUMBPRINT", "/tr", "http://time.certum.pl", "/td", "sha256", "/fd", "sha1", "/v", "./${env:DIST_FILE_NAME}.exe" + WorkingDirectory = "." + NoNewWindow = $true + } + Start-Process @processOptions1 + + # 2nd signing + $processOptions2 = @{ + FilePath = "C:\Program Files (x86)/Windows Kits/10/bin/10.0.22621.0/x64/signtool.exe" + Wait = $true + ArgumentList = "sign", "/sha1", "$env:CODESIGN_WIN_THUMBPRINT", "/tr", "http://time.certum.pl", "/td", "sha256", "/fd", "sha256", "/v", "./${env:DIST_FILE_NAME}.exe" + WorkingDirectory = "." + NoNewWindow = $true + } + Start-Process @processOptions2 + + # Create release binary zip + $compress = @{ + Path = "./${env:DIST_FILE_NAME}.exe" + CompressionLevel = "Fastest" + DestinationPath = "${env:DIST_FILE_NAME}-${{ needs.release-please.outputs.release_tag_name }}-win.zip" + } + Compress-Archive @compress + + # Add additional directories & files to the created zip file, if any + + Compress-Archive -Path "./config" -Update -DestinationPath "./${env:DIST_FILE_NAME}-${{ needs.release-please.outputs.release_tag_name }}-win.zip" + + - name: Upload to existing release + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + omitBodyDuringUpdate: true + omitNameDuringUpdate: true + artifactContentType: raw + # artifactContentType: application/zip + draft: true + tag: ${{ needs.release-please.outputs.release_tag_name }} + artifacts: ./qs-jwt-${{ needs.release-please.outputs.release_tag_name }}-win.zip + token: ${{ github.token }} + + - name: Tidy up before existing + run: | + dir + del qs-jwt.cjs + del "./${env:DIST_FILE_NAME}.exe" + del "./${env:DIST_FILE_NAME}-${{ needs.release-please.outputs.release_tag_name }}-win.zip" + + release-linux: + needs: release-please + runs-on: ubuntu-latest + # timeout-minutes: 15 + + if: needs.release-please.outputs.releases_created == 'true' + env: + DIST_FILE_NAME: qs-jwt + GITHUB_TOKEN: ${{ secrets.PAT }} + steps: + - name: Release tag and upload url from previous job + run: | + echo "tag_name : ${{ needs.release-please.outputs.release_tag_name }}" + echo "upload_url : ${{ needs.release-please.outputs.release_upload_url }}" + + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: Install tool for creating stand-alone executables + run: | + npm install pkg --location=global + npm install --save-exact esbuild + + - name: Install dependencies + run: | + pwd + npm ci --include=prod + + - name: Build binaries + run: | + ./node_modules/.bin/esbuild ./qs-jwt.js --bundle --external:axios --external:xdg-open --external:enigma.js --outfile=qs-jwt.cjs --format=cjs --platform=node --target=node18 --minify + pkg --output "./${DIST_FILE_NAME}" -t node18-linux-x64 ./qs-jwt.cjs --config package.json --compress GZip + + chmod +x ${DIST_FILE_NAME} + + - name: Make binary executable + run: | + chmod +x ./${DIST_FILE_NAME} + + - name: Compress release binary + run: | + # Compress insider's build + # Include following directories & files in the created archive file. + # - ./src/config/log_appender_xml + # - ./src/config⁄production_template.yaml + + ls -la + zip -9 -r ./${DIST_FILE_NAME}-${{ needs.release-please.outputs.release_tag_name }}-linux.zip ${DIST_FILE_NAME} + + + - name: Debug + run: | + ls -la + + - name: Upload to existing release + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + omitBodyDuringUpdate: true + omitNameDuringUpdate: true + artifactContentType: raw + # artifactContentType: application/zip + draft: true + tag: ${{ needs.release-please.outputs.release_tag_name }} + artifacts: ./qs-jwt-${{ needs.release-please.outputs.release_tag_name }}-linux.zip + token: ${{ github.token }} + + - name: Tidy up before existing + run: | + pwd + ls -la + rm qs-jwt.cjs + rm "./${DIST_FILE_NAME}" + rm "./${DIST_FILE_NAME}-${{ needs.release-please.outputs.release_tag_name }}-linux.zip" diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yaml similarity index 100% rename from .github/workflows/codeql-analysis.yml rename to .github/workflows/codeql-analysis.yaml diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml deleted file mode 100644 index 32df451..0000000 --- a/.github/workflows/release-please.yml +++ /dev/null @@ -1,372 +0,0 @@ -name: ci-pipeline - -on: - workflow_dispatch: - push: - branches: - - main - -jobs: - release-please: - runs-on: ubuntu-latest - outputs: - releases_created: ${{ steps.release.outputs.releases_created }} - release_tag_name: ${{ steps.release.outputs.tag_name }} - release_upload_url: ${{ steps.release.outputs.upload_url }} - env: - GITHUB_REF: ${{ github.ref }} - GITHUB_TOKEN: ${{ secrets.PAT }} - DIST_FILE_NAME: qs-jwt - steps: - - name: Show github.ref - run: echo "$GITHUB_REF" - - - name: Install tools - run: sudo apt-get install jq - - - uses: google-github-actions/release-please-action@v3 - id: release - if: | - github.repository_owner == 'ptarmiganlabs' - with: - command: manifest - - - name: Show output from Release-Please - if: always() - env: - RELEASE_PLEASE_OUTPUT: ${{ toJSON(steps.release.outputs) }} - # echo "All outputs : ${{ toJSON(steps.release.outputs) }}" - # run: echo ${{ toJSON(steps.release.outputs) }} - run: echo "$RELEASE_PLEASE_OUTPUT" - - - name: Show output from Release-Please - # if: ${{ steps.release.outputs.releases_created }} - run: | - echo "release_created : ${{ steps.release.outputs.release_created }}" - echo "releases_created: ${{ steps.release.outputs.releases_created }}" - echo "draft : ${{ steps.release.outputs['draft'] }}" - echo "path : ${{ steps.release.outputs['path'] }}" - echo "upload_url : ${{ steps.release.outputs['upload_url'] }}" - echo "html_url : ${{ steps.release.outputs['html_url'] }}" - echo "tag_name : ${{ steps.release.outputs['tag_name'] }}" - echo "version : ${{ steps.release.outputs['version'] }}" - echo "major : ${{ steps.release.outputs['major'] }}" - echo "minor : ${{ steps.release.outputs['minor'] }}" - echo "patch : ${{ steps.release.outputs['patch'] }}" - echo "sha : ${{ steps.release.outputs['sha'] }}" - - - name: Checkout repository - if: github.repository_owner == 'ptarmiganlabs' - uses: actions/checkout@v3 - - - name: Install dependencies - run: | - ls -la - npm install - - - name: Run Snyk to check for vulnerabilities - if: github.repository_owner == 'ptarmiganlabs' - uses: snyk/actions/node@master - continue-on-error: true - env: - SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} - with: - args: --file=./package.json --sarif-file-output=snyk.sarif - # command: test - - - name: Upload Snyk result to GitHub Code Scanning - uses: github/codeql-action/upload-sarif@v2 - with: - sarif_file: snyk.sarif - - - name: Install tool for creating stand-alone executables - if: ${{ steps.release.outputs.releases_created }} - run: npm install -g pkg - - - name: Package stand-alone binaries - if: ${{ steps.release.outputs.releases_created }} - # mkdir release/alpine - # pkg --output release/alpine/${DIST_FILE_NAME} -t node16-alpine-x64 index.js - run: | - pwd - ls -la - mkdir release - mkdir release/macos - mkdir release/win - mkdir release/linux - pkg --config ./package.json --output release/linux/${DIST_FILE_NAME} -t node16-linux-x64 qs-jwt.js - pkg --config ./package.json --output release/macos/${DIST_FILE_NAME} -t node16-macos-x64 qs-jwt.js - pkg --config ./package.json --output release/win/${DIST_FILE_NAME}.exe -t node16-win-x64 qs-jwt.js - - - name: Debug - if: ${{ steps.release.outputs.releases_created }} - run: | - ls -la - ls -la release - ls -la release/macos - ls -la release/win - ls -la release/linux - - - name: VirusTotal Scan - if: ${{ steps.release.outputs.releases_created }} - uses: crazy-max/ghaction-virustotal@v3 - with: - vt_api_key: ${{ secrets.VIRUSTOTAL_API_KEY }} - request_rate: 4 - files: | - ./release/macos/* - ./release/win/* - ./release/linux/* - - - name: Upload macOS build artifacts - if: ${{ steps.release.outputs.releases_created }} - uses: actions/upload-artifact@v3 - with: - name: binaries-macos - path: release/macos/* - - - name: Upload Linux build artifacts - if: ${{ steps.release.outputs.releases_created }} - uses: actions/upload-artifact@v3 - with: - name: binaries-linux - path: release/linux/* - - - name: Upload Windows build artifacts - if: ${{ steps.release.outputs.releases_created }} - uses: actions/upload-artifact@v3 - with: - name: binaries-win - path: release/win/* - - release-macos: - needs: release-please - runs-on: - - self-hosted - - x64 - - macos - - sp53 - # timeout-minutes: 15 - - if: ${{ needs.release-please.outputs.releases_created }} - env: - DIST_FILE_NAME: qs-jwt - steps: - - name: Release tag and upload url from previous job - run: | - echo "tag_name : ${{ needs.release-please.outputs.release_tag_name }}" - echo "upload_url : ${{ needs.release-please.outputs.release_upload_url }}" - - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup node - uses: actions/setup-node@v3 - with: - node-version: lts/* - - - name: Download-Binaries - uses: actions/download-artifact@v3 - with: - name: binaries-macos - path: release-macos/ - - - name: Make binary executable - run: | - chmod +x release-macos/${DIST_FILE_NAME} - - # Needed for GitHub hosted runner - # For self-hosted runner the cert must either be installed manually, or the code below run once and then disabled. - # - name: Import Code-Signing Certificates - # uses: Apple-Actions/import-codesign-certs@v1 - # with: - # # The certificates in a PKCS12 file encoded as a base64 string - # p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }} - # # The password used to import the PKCS12 file. - # p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }} - - # - name: Install gon via HomeBrew for code signing and app notarization - # run: | - # brew tap mitchellh/gon - # brew install mitchellh/gon/gon - - - name: Debug - run: | - ls -la - ls -la ./release-macos - - - name: Sign the mac binaries with Gon - env: - AC_USERNAME: ${{ secrets.AC_USERNAME }} - AC_PASSWORD: ${{ secrets.AC_PASSWORD }} - AC_APP_IDENTITY: ${{ secrets.AC_APP_IDENTITY }} - run: | - pwd - ls -la - gon ./release-config/gon.json - - - name: Debug - run: | - pwd - ls -la - ls -la ./release-macos - - name: Change name of zip file - run: | - pwd - ls -la - ls -la ./release-macos - mv ./${{ env.DIST_FILE_NAME }}-macos.zip ./${{ needs.release-please.outputs.release_tag_name }}-macos.zip - - - name: Upload to existing release - uses: ncipollo/release-action@v1 - with: - allowUpdates: true - omitBodyDuringUpdate: true - omitNameDuringUpdate: true - artifactContentType: raw - # artifactContentType: application/zip - draft: true - tag: ${{ needs.release-please.outputs.release_tag_name }} - artifacts: ./${{ needs.release-please.outputs.release_tag_name }}-macos.zip - token: ${{ github.token }} - - - name: Tidy up before existing - run: | - rm -r release-macos - - release-linux: - needs: release-please - runs-on: ubuntu-latest - # timeout-minutes: 15 - - if: ${{ needs.release-please.outputs.releases_created }} - env: - DIST_FILE_NAME: qs-jwt - steps: - - name: Release tag and upload url from previous job - run: | - echo "tag_name : ${{ needs.release-please.outputs.release_tag_name }}" - echo "upload_url : ${{ needs.release-please.outputs.release_upload_url }}" - - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup node - uses: actions/setup-node@v3 - with: - node-version: lts/* - - - name: Download-Binaries - uses: actions/download-artifact@v3 - with: - name: binaries-linux - path: release-linux/ - - - name: Make binary executable - run: | - chmod +x release-linux/${DIST_FILE_NAME} - - - name: Compress into zip - run: | - ls -la - ls -la ./release-linux - zip -9 -r ./${{ needs.release-please.outputs.release_tag_name }}-linux.zip release-linux/ - - - name: Upload to existing release - uses: ncipollo/release-action@v1 - with: - allowUpdates: true - omitBodyDuringUpdate: true - omitNameDuringUpdate: true - artifactContentType: raw - # artifactContentType: application/zip - draft: true - tag: ${{ needs.release-please.outputs.release_tag_name }} - artifacts: ./${{ needs.release-please.outputs.release_tag_name }}-linux.zip - token: ${{ github.token }} - - - name: Tidy up before existing - run: | - rm -r release-linux - - release-win64: - needs: release-please - runs-on: - - self-hosted - - x64 - - windows - - sp53 - # timeout-minutes: 15 - if: ${{ needs.release-please.outputs.releases_created }} - env: - DIST_FILE_NAME: qs-jwt - steps: - - name: Release tag and upload url from previous job - run: | - Write-Output 'tag_name : ${{ needs.release-please.outputs.release_tag_name }}' - Write-Output 'upload_url : ${{ needs.release-please.outputs.release_upload_url }}' - - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup node - uses: actions/setup-node@v3 - with: - node-version: lts/* - - - name: Download-Binaries - uses: actions/download-artifact@v3 - with: - name: binaries-win - path: release-win/ - - - name: Sign the executable - env: - CODESIGN_PWD: ${{ secrets.WIN_CODESIGN_PWD}} - CODESIGN_INTERMEDIATE_BASE64: ${{ secrets.WIN_CODESIGN_INTERMEDIATE_BASE64 }} - CODESIGN_BASE64: ${{ secrets.WIN_CODESIGN_BASE64}} - run: | - New-Item -ItemType directory -Path certificate - Set-Content -Path certificate\certificate.txt -Value $env:CODESIGN_BASE64 - certutil -decode certificate\certificate.txt certificate\certificate.pfx - Set-Content -Path certificate\intermediate.txt -Value $env:CODESIGN_INTERMEDIATE_BASE64 - certutil -decode certificate\intermediate.txt certificate\intermediate.crt - - & 'C:\Program Files (x86)/Windows Kits/10/bin/10.0.22621.0/x64/signtool.exe' sign /fd SHA256 /p $env:CODESIGN_PWD /ac certificate\intermediate.crt /f certificate\certificate.pfx /tr "http://timestamp.sectigo.com/rfc3161" /td sha256 release-win/qs-jwt.exe - - Remove-Item -Recurse -Force certificate - - - name: Install dependencies and zip into release asset - run: | - cd release-win - dir - $compress = @{ - Path = "." - CompressionLevel = "Fastest" - DestinationPath = "${{ needs.release-please.outputs.release_tag_name }}-win.zip" - } - Compress-Archive @compress - - - name: Debug - run: | - dir - dir ./release-win - - - name: Upload to existing release - uses: ncipollo/release-action@v1 - with: - allowUpdates: true - omitBodyDuringUpdate: true - omitNameDuringUpdate: true - artifactContentType: raw - # artifactContentType: application/zip - draft: true - tag: ${{ needs.release-please.outputs.release_tag_name }} - artifacts: release-win/${{ needs.release-please.outputs.release_tag_name }}-win.zip - token: ${{ github.token }} - - - name: Tidy up before existing - run: | - dir - Remove-Item -path ./release-win -recurse - diff --git a/.github/workflows/virus-scan.yml b/.github/workflows/virus-scan.yaml similarity index 67% rename from .github/workflows/virus-scan.yml rename to .github/workflows/virus-scan.yaml index 7deef6e..db1b695 100644 --- a/.github/workflows/virus-scan.yml +++ b/.github/workflows/virus-scan.yaml @@ -7,10 +7,14 @@ on: jobs: virustotal: runs-on: ubuntu-latest + if: | + github.event_name != 'pull_request' && + github.repository_owner == 'ptarmiganlabs' + steps: - name: VirusTotal Scan - uses: crazy-max/ghaction-virustotal@v3 + uses: crazy-max/ghaction-virustotal@v4 with: vt_api_key: ${{ secrets.VIRUSTOTAL_API_KEY }} request_rate: 4 diff --git a/.gitignore b/.gitignore index f1d8c3a..edd734e 100644 --- a/.gitignore +++ b/.gitignore @@ -111,3 +111,5 @@ dist # TernJS port file .tern-port +qs-jwt +qs-jwt.cjs diff --git a/README.md b/README.md index 8d7ee25..06a4777 100644 --- a/README.md +++ b/README.md @@ -514,7 +514,7 @@ $QSJWTPRIVKEY = Get-Content .\privatekey.pem -Raw ## QS Cloud: Create new certificate and key pair, then create JWT -![qs-jwt creating both new cert, keys and JWT](./docs/img/qs-jwt-qscloud-new-cert-1.png "qs-jwt creating both new cert, keys and JWT") +![qs-jwt creating both new cert, keys and JWT](./docs/img/qs-jwt-qseow-new-cert-1.png "qs-jwt creating both new cert, keys and JWT") If you **do not** have a certificate with associated private key (PEM encoded) qs-jwt can create these for you. You will get a complete public-private key pair + certificate based on the private key, rather than just the private key (which is what qs-jwt uses). @@ -593,7 +593,7 @@ Powershell on macOS: ## Qlik Sense Cloud -These days (May 2023) JWTs are enabled on all Qlik Cloud tentants by default. In the past this feature was enabled for tenants only on a case-by-case basis - that is no longer the case though. +These days (May 2023) JWTs are enabled on all Qlik Cloud tenants by default. In the past this feature was enabled for tenants only on a case-by-case basis - that is no longer the case though. Qlik Sense Cloud is quite flexible when it comes to authentication and Identify Providers (IdPs) and there are officially supported options (e.g. some OAuth based variant) that can probably be used in most scenarios where JWTs are considered. Still, JWTs are a simple and proven concept that has its own advantages. diff --git a/release-please-config.json b/release-please-config.json index ae5bf41..aafeb5a 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -1,32 +1,39 @@ { "release-type": "node", "draft": true, + "release-search-depth": 10, + "commit-search-depth": 200, "changelog-sections": [ - { - "type": "feat", - "section": "Features", - "hidden": false - }, - { - "type": "fix", - "section": "Bug Fixes", - "hidden": false - }, - { - "type": "chore", - "section": "Miscellaneous", - "hidden": false - }, - { - "type": "refactor", - "section": "Refactoring", - "hidden": true - }, - { - "type": "docs", - "section": "Documentation", - "hidden": false - } + { + "type": "feat", + "section": "Features", + "hidden": false + }, + { + "type": "fix", + "section": "Bug Fixes", + "hidden": false + }, + { + "type": "chore", + "section": "Miscellaneous", + "hidden": false + }, + { + "type": "refactor", + "section": "Refactoring", + "hidden": false + }, + { + "type": "docs", + "section": "Documentation", + "hidden": false + }, + { + "type": "build", + "section": "Miscellaneous", + "hidden": false + } ], "packages": { ".": {