diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index b6e0416..6decee2 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -1,5 +1,8 @@ name: Build library -on: [push] +on: + push: + branches: + - master jobs: macos: @@ -10,24 +13,30 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Check out repository - uses: actions/checkout@v3 - - name: Use Node.js v16 - uses: actions/setup-node@v3 + uses: actions/checkout@v4 + - name: Use Node.js v20 + uses: actions/setup-node@v4 with: - node-version: '16' + node-version: '20.x' - name: Install dependencies run: npm install --ignore-scripts - name: Install ninja run: brew install ninja - name: Build - run: npm run build:config && npm run build:rx64 - # - name: Run tests - # run: npm test - - name: Create artifacts - uses: actions/upload-artifact@v3 + run: | + npm run build:config + npm run build:rx64 + npm run build:rARM64 + - name: Create artifacts for X64 + uses: actions/upload-artifact@v4 with: - name: Package for ${{ matrix.os }} + name: Package for MacOS x64 path: out/Release_x64/libpvpkcs11.dylib + - name: Create artifacts for ARM64 + uses: actions/upload-artifact@v4 + with: + name: Package for MacOS ARM64 + path: out/Release_MACARM64/libpvpkcs11.dylib windows: strategy: matrix: @@ -40,11 +49,11 @@ jobs: name: Windows ${{ matrix.platform }} steps: - name: Check out repository - uses: actions/checkout@v3 - - name: Use Node.js v16 - uses: actions/setup-node@v3 + uses: actions/checkout@v4 + - name: Use Node.js v20 + uses: actions/setup-node@v4 with: - node-version: '16' + node-version: '20.x' - name: Install dependencies run: npm install --ignore-scripts - name: Install ninja @@ -62,10 +71,86 @@ jobs: run: npm run build:config - name: Build Library run: npm run build:r${{ matrix.platform }} - # - name: Run tests - # run: npm test - name: Create artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 + with: + name: Package for Win ${{ matrix.platform }} + path: out/Release_${{ matrix.platform }}/pvpkcs11.dll + + create-release: + name: Create Release + needs: [macos, windows] + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v4 + - name: Download artifacts for MacOS x64 + uses: actions/download-artifact@v4 + with: + name: Package for MacOS x64 + path: out/Release_x64 + - name: Download artifacts for MacOS ARM64 + uses: actions/download-artifact@v4 + with: + name: Package for MacOS ARM64 + path: out/Release_MACARM64 + - name: Download artifacts for Windows x86 + uses: actions/download-artifact@v4 + with: + name: Package for Win x86 + path: out/Release_x86 + - name: Download artifacts for Windows x64 + uses: actions/download-artifact@v4 + with: + name: Package for Win x64 + path: out/Release_x64 + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.run_number }} + release_name: Release ${{ github.run_number }} + draft: false + prerelease: false + - name: Upload Release Asset MacOS x64 + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: out/Release_x64/libpvpkcs11.dylib + asset_name: libpvpkcs11_x64.dylib + asset_content_type: application/x-sharedlib + - name: Upload Release Asset MacOS ARM64 + id: upload-release-asset-arm64 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: out/Release_MACARM64/libpvpkcs11.dylib + asset_name: libpvpkcs11_ARM64.dylib + asset_content_type: application/x-sharedlib + - name: Upload Release Asset Windows x86 + id: upload-release-asset-x86 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: out/Release_x86/pvpkcs11.dll + asset_name: pvpkcs11_x86.dll + asset_content_type: application/x-sharedlib + - name: Upload Release Asset Windows x64 + id: upload-release-asset-x64 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - name: Package for ${{ matrix.os }} ${{ matrix.platform }} - path: out/Release_${{ matrix.platform }}/pvpkcs11.dll \ No newline at end of file + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: out/Release_x64/pvpkcs11.dll + asset_name: pvpkcs11_x64.dll + asset_content_type: application/x-sharedlib \ No newline at end of file diff --git a/config.gyp b/config.gyp index 55d6c97..52ada28 100644 --- a/config.gyp +++ b/config.gyp @@ -23,7 +23,7 @@ } }, 'Release_MACARM64': { - 'inherit_from': ['Release_MACARM64'], + 'inherit_from': ['Release_x86'], 'xcode_settings': { 'ARCHS': ['arm64'], } diff --git a/package.json b/package.json index a88da1d..03800df 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "build:config": "gyp config.gyp", "build:rx86": "ninja -C out/Release_x86", "build:rx64": "ninja -C out/Release_x64", + "build:rARM64": "ninja -C out/Release_MACARM64", "prebuild:rx86": "gyp --D \"target_arch=ia32\" config.gyp", "build:dx86": "ninja -C out/Debug", "build:dx64": "ninja -C out/Debug_x64"