From db6e1f332856d98bb1d24afa8fe3ea08e53050d8 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Thu, 25 Jan 2024 16:55:24 +0000 Subject: [PATCH] chore: publish main package (#532) # Description Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. ## Link to issue Please add a link to any relevant issues/tickets. ## Type of change - [ ] Bug fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Refactor (non-breaking change that updates existing functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update - [ ] Comments have been added/updated Please delete options that are not relevant. ## Test plan (required) Demonstrate the code is solid. Which commands did you test with and what are the expected results? Which tests have you added or updated? Do the tests cover all of the changes included in this PR? ## Screenshots/Screencaps Please add previews of any UI Changes. --------- Co-authored-by: Zeeshan Lakhani --- .github/workflows/builds.yml | 63 ++++- homestar-runtime/npm/base/package-lock.json | 263 ------------------ ...ckage.json.tmpl => package-json-arch.tmpl} | 0 homestar-runtime/npm/package-json-base.tmpl | 37 +++ .../package.json => package-json-baserc.tmpl} | 13 +- 5 files changed, 94 insertions(+), 282 deletions(-) delete mode 100644 homestar-runtime/npm/base/package-lock.json rename homestar-runtime/npm/{package.json.tmpl => package-json-arch.tmpl} (100%) create mode 100644 homestar-runtime/npm/package-json-base.tmpl rename homestar-runtime/npm/{base/package.json => package-json-baserc.tmpl} (75%) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index a459795f..583e76a7 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -25,7 +25,7 @@ jobs: binary-builds: if: > startsWith(github.event.release.name, 'homestar-runtime') || - (github.event_name == 'workflow_dispatch' && github.event.inputs.force-publish) + (github.event_name == 'workflow_dispatch' && github.event.inputs.force-builds) strategy: fail-fast: false matrix: @@ -100,7 +100,7 @@ jobs: include: LICENSE,README.md token: ${{ secrets.GITHUB_TOKEN }} - npm-publish: + npm-publish-arch: needs: binary-builds runs-on: ubuntu-latest strategy: @@ -133,7 +133,7 @@ jobs: with: node-version: lts/* registry-url: "https://registry.npmjs.org" - - name: Install cargo get + - name: Install cargo-get run: cargo install cargo-get - name: Prepare os/arch packages shell: bash @@ -146,21 +146,22 @@ jobs: echo "node_pkg=${node_pkg}" >> "$GITHUB_ENV" cd homestar-runtime/npm mkdir -p "${node_pkg}/bin" - envsubst < package.json.tmpl > "${node_pkg}/package.json" + envsubst < package-json-arch.tmpl > "${node_pkg}/package.json" - name: Download build artifacts uses: actions/download-artifact@v4 with: name: ${{ matrix.target }} path: "homestar-runtime/npm/${{ env.node_pkg }}/bin" - - name: Publish production + - name: Publish arch packages to production if: github.event_name == 'release' && github.event.action == 'published' run: | cp homestar-runtime/README.md "homestar-runtime/npm/${{ env.node_pkg }}" cd "homestar-runtime/npm/${{ env.node_pkg }}" + chmod +x bin/${{ matrix.bin }} npm publish --access=public env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - - name: Publish RC + - name: Publish arch packages RC if: github.event_name == 'workflow_dispatch' run: | cp homestar-runtime/README.md "homestar-runtime/npm/${{ env.node_pkg }}" @@ -171,6 +172,40 @@ jobs: env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + npm-publish-main: + needs: npm-publish-arch + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: lts/* + registry-url: "https://registry.npmjs.org" + - name: Install cargo get + run: cargo install cargo-get + - name: Publish main package to production + if: github.event_name == 'release' && github.event.action == 'published' + run: | + export node_version=$(cargo get workspace.package.version) + cp homestar-runtime/README.md homestar-runtime/npm/base + cd homestar-runtime/npm + envsubst < package-json-base.tmpl > "base/package.json" + cd base + npm publish --access=public + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + - name: Publish main package RC + if: (github.event_name == 'workflow_dispatch' && github.event.inputs.force-builds) + run: | + export node_version="$(cargo get workspace.package.version)-rc.$(date +%s)" + cp homestar-runtime/README.md homestar-runtime/npm/base + cd homestar-runtime/npm + envsubst < package-json-baserc.tmpl > "base/package.json" + cd base + npm publish --access public --tag rc + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + build-packages: needs: binary-builds runs-on: ubuntu-latest @@ -240,7 +275,7 @@ jobs: docker-build: if: > startsWith(github.event.release.name, 'homestar-runtime') || - (github.event_name == 'workflow_dispatch' && github.event.inputs.force-publish) + (github.event_name == 'workflow_dispatch' && github.event.inputs.force-builds) runs-on: ubuntu-latest env: DOCKER_BUILDKIT: "1" @@ -267,10 +302,14 @@ jobs: sudo apt-get clean sudo rm -rf /usr/share/dotnet - - name: Get Current Version - if: (github.event_name == 'workflow_dispatch' && github.event.inputs.force-publish) + - name: Install cargo-get + if: (github.event_name == 'workflow_dispatch' && github.event.inputs.force-builds) + run: cargo install cargo-get + + - name: Set Current Version + if: (github.event_name == 'workflow_dispatch' && github.event.inputs.force-builds) id: crate-version - run: echo version=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "homestar-runtime") | .version') >> $GITHUB_OUTPUT + run: echo version=$(cargo get workspace.package.version)-rc.$(date +%s) >> $GITHUB_OUTPUT - name: Login to GitHub Container Registry uses: docker/login-action@v3 @@ -298,7 +337,7 @@ jobs: type=sha - name: Metadata - if: (github.event_name == 'workflow_dispatch' && github.event.inputs.force-publish) + if: (github.event_name == 'workflow_dispatch' && github.event.inputs.force-builds) id: meta-dispatch uses: docker/metadata-action@v5 with: @@ -322,7 +361,7 @@ jobs: labels: ${{ steps.meta-release.outputs.labels }} - name: Docker Build & Push - if: (github.event_name == 'workflow_dispatch' && github.event.inputs.force-publish) + if: (github.event_name == 'workflow_dispatch' && github.event.inputs.force-builds) uses: docker/build-push-action@v5 with: cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest diff --git a/homestar-runtime/npm/base/package-lock.json b/homestar-runtime/npm/base/package-lock.json deleted file mode 100644 index dcf9b431..00000000 --- a/homestar-runtime/npm/base/package-lock.json +++ /dev/null @@ -1,263 +0,0 @@ -{ - "name": "homestar-runtime", - "version": "0.0.8", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "homestar-runtime", - "version": "0.0.8", - "license": "MIT", - "dependencies": { - "execa": "^8.0.1" - }, - "bin": { - "homestar": "index.js" - }, - "optionalDependencies": { - "homestar-darwin-arm64": "*", - "homestar-darwin-x64": "*", - "homestar-linux-arm64": "*", - "homestar-linux-x64": "*", - "homestar-windows-arm64": "*", - "homestar-windows-x64": "*" - } - }, - "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/execa": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", - "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^8.0.1", - "human-signals": "^5.0.0", - "is-stream": "^3.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^5.1.0", - "onetime": "^6.0.0", - "signal-exit": "^4.1.0", - "strip-final-newline": "^3.0.0" - }, - "engines": { - "node": ">=16.17" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/get-stream": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", - "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/homestar-darwin-arm64": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/homestar-darwin-arm64/-/homestar-darwin-arm64-0.0.1.tgz", - "integrity": "sha512-ftcZyXJalctBtj3jhTepLVE6LjNaB/k2KB9zAAZjQi6neAKs+MMTqaRt8TV3/X16hOryOeyjDPCshgbGnqpBJw==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/homestar-darwin-x64": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/homestar-darwin-x64/-/homestar-darwin-x64-0.0.1.tgz", - "integrity": "sha512-DT4H2XnKD6bwjY/3ooYRwfqnP8maKlLp53ZOkeSPIWT8HDf7DI/6WJxeZZy8AGkMox5SU0xP64CrIQ3W/D57NA==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/homestar-linux-arm64": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/homestar-linux-arm64/-/homestar-linux-arm64-0.0.1.tgz", - "integrity": "sha512-IKDrLIvZWmp1ZrcYyySV1xp7wOYOCHPELeuiOEd0a3YuHssURXS4CdibUGKXGnTnxv7w7bjNla5HAVyOnC/dNA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/homestar-linux-x64": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/homestar-linux-x64/-/homestar-linux-x64-0.0.1.tgz", - "integrity": "sha512-LuY2HA3SM1B5B4LFpyb+eAKHFaKlEJ0vtkr/aFJCR9d0SA/omf3ZpqmeT4zDrCNgCnqT81rvVDjBOP094890zw==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/human-signals": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", - "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", - "engines": { - "node": ">=16.17.0" - } - }, - "node_modules/is-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", - "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" - }, - "node_modules/merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" - }, - "node_modules/mimic-fn": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", - "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/npm-run-path": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", - "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==", - "dependencies": { - "path-key": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/npm-run-path/node_modules/path-key": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", - "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/onetime": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", - "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", - "dependencies": { - "mimic-fn": "^4.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "engines": { - "node": ">=8" - } - }, - "node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/strip-final-newline": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", - "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - } - } -} diff --git a/homestar-runtime/npm/package.json.tmpl b/homestar-runtime/npm/package-json-arch.tmpl similarity index 100% rename from homestar-runtime/npm/package.json.tmpl rename to homestar-runtime/npm/package-json-arch.tmpl diff --git a/homestar-runtime/npm/package-json-base.tmpl b/homestar-runtime/npm/package-json-base.tmpl new file mode 100644 index 00000000..9834ef9a --- /dev/null +++ b/homestar-runtime/npm/package-json-base.tmpl @@ -0,0 +1,37 @@ +{ + "name": "homestar-runtime", + "version": "${node_version}", + "description": "The IPVM reference implementation", + "author": "Hugo Dias (hugodias.me)", + "homepage": "https://github.com/ipvm-wg/homestar/tree/main/homestar-runtime", + "repository": { + "url": "ipvm-wg/homestar", + "directory": "homestar-runtime" + }, + "keywords": [ + "homestar", + "wasm", + "wit", + "webassembly", + "workflows", + "scheduling" + ], + "bin": { + "homestar": "index.js" + }, + "type": "module", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "license": "Apache-2.0", + "optionalDependencies": { + "homestar-darwin-arm64": "${node_version}", + "homestar-darwin-x64": "${node_version}", + "homestar-linux-arm64": "${node_version}", + "homestar-linux-x64": "${node_version}", + "homestar-windows-x64": "${node_version}" + }, + "dependencies": { + "execa": "^8.0.1" + } +} diff --git a/homestar-runtime/npm/base/package.json b/homestar-runtime/npm/package-json-baserc.tmpl similarity index 75% rename from homestar-runtime/npm/base/package.json rename to homestar-runtime/npm/package-json-baserc.tmpl index d5a6669a..7004638a 100644 --- a/homestar-runtime/npm/base/package.json +++ b/homestar-runtime/npm/package-json-baserc.tmpl @@ -1,6 +1,6 @@ { "name": "homestar-runtime", - "version": "0.0.8", + "version": "${node_version}", "description": "The IPVM reference implementation", "author": "Hugo Dias (hugodias.me)", "homepage": "https://github.com/ipvm-wg/homestar/tree/main/homestar-runtime", @@ -25,12 +25,11 @@ }, "license": "Apache-2.0", "optionalDependencies": { - "homestar-darwin-arm64": "*", - "homestar-darwin-x64": "*", - "homestar-linux-arm64": "*", - "homestar-linux-x64": "*", - "homestar-windows-arm64": "*", - "homestar-windows-x64": "*" + "homestar-darwin-arm64": "rc", + "homestar-darwin-x64": "rc", + "homestar-linux-arm64": "rc", + "homestar-linux-x64": "rc", + "homestar-windows-x64": "rc" }, "dependencies": { "execa": "^8.0.1"