From 7a52ab299ea1407411b69c66bde4fc3bf163f26a Mon Sep 17 00:00:00 2001 From: Bobby Galli Date: Wed, 20 Mar 2024 14:18:34 -0400 Subject: [PATCH] chore: pkg workflow --- .github/workflows/pkg.yaml | 39 ++++++++++++++++++++++++++++++++++++++ package.json | 14 ++++++-------- 2 files changed, 45 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/pkg.yaml diff --git a/.github/workflows/pkg.yaml b/.github/workflows/pkg.yaml new file mode 100644 index 0000000..d39ecb3 --- /dev/null +++ b/.github/workflows/pkg.yaml @@ -0,0 +1,39 @@ +name: Build and Upload Artifacts for Multiple OS + +on: [push] + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + include: + - os: ubuntu-latest + run_script: pkg:linux + artifact_name: symbol-upload-linux + - os: macos-latest + run_script: pkg:macos + artifact_name: symbol-upload-macos + - os: windows-latest + run_script: pkg:win + artifact_name: symbol-upload-win + + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + + - name: Install dependencies + run: npm ci + + - name: Run platform-specific script + run: npm run ${{ matrix.run_script }} # Executes the script based on the operating system + + - uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.artifact_name }} + path: pkg/* # Uploads the artifact with a platform-specific name and path diff --git a/package.json b/package.json index c19af10..83be3c3 100644 --- a/package.json +++ b/package.json @@ -24,8 +24,12 @@ "build": "tsc", "prerelease": "npm run build", "release": "npm publish --access public", - "prepkg": "npm run build", - "pkg": "npx pkg package.json", + "prepkg:linux": "npm run build", + "pkg:linux": "npx pkg package.json --targets node18-linux-x64 --output ./pkg/symbol-upload-linux", + "prepkg:macos": "npm run build", + "pkg:macos": "npx pkg package.json --targets node18-macos-x64 --output ./pkg/symbol-upload-macos", + "prepkg:windows": "npm run build", + "pkg:windows": "npx pkg package.json --targets node18-win-x64 --output ./pkg/symbol-upload-windows", "act": "act --secret-file .env" }, "repository": { @@ -48,12 +52,6 @@ "homepage": "https://github.com/BugSplat-Git/symbol-upload#readme", "pkg": { "scripts": "./dist/**/*.js", - "targets": [ - "node18-macos-x64", - "node18-linux-x64", - "node18-win-x64" - ], - "outputPath": "./pkg", "compress": "GZip", "assets": [ "package.json",