From ce24739a4a70d0ff0efb995f2ea314cf38c3c268 Mon Sep 17 00:00:00 2001 From: Finn Hodgkin Date: Fri, 18 Oct 2024 11:34:43 +0100 Subject: [PATCH] Adds npm publishing --- .github/workflows/release.yml | 31 ++++++++++++++++++++++++++++++- build.sh | 1 + dist.toml | 4 ++-- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9471b98..fc5d3d5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -58,7 +58,8 @@ jobs: steps: - uses: actions/checkout@v4 with: - lfs: 'true' + submodules: recursive + lfs: "true" - name: Install cargo-dist # we specify bash to get pipefail; it guards against the `curl` command # failing. otherwise `sh` won't catch that `curl` returned non-0 @@ -266,6 +267,34 @@ jobs: gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/* + publish-npm: + needs: + - plan + - host + runs-on: "ubuntu-20.04" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PLAN: ${{ needs.plan.outputs.val }} + if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }} + steps: + - name: Fetch npm packages + uses: actions/download-artifact@v4 + with: + pattern: artifacts-* + path: npm/ + merge-multiple: true + - uses: actions/setup-node@v4 + with: + node-version: '20.x' + registry-url: 'https://registry.npmjs.org' + - run: | + for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith("-npm-package.tar.gz")] | any)'); do + pkg=$(echo "$release" | jq '.artifacts[] | select(endswith("-npm-package.tar.gz"))' --raw-output) + npm publish --access public "./npm/${pkg}" + done + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + announce: needs: - plan diff --git a/build.sh b/build.sh index 8ff2f36..76f5400 100644 --- a/build.sh +++ b/build.sh @@ -6,6 +6,7 @@ if [ -n "${CARGO_DIST_TARGET:-}" ]; then case "${CARGO_DIST_TARGET}" in aarch64-apple-darwin) # Do nothing - binary already built + chmod 755 purs ;; x86_64-apple-darwin) # TODO once we have the intel binary, rename the intel binary to purs here diff --git a/dist.toml b/dist.toml index 3d4b8a3..577daa7 100644 --- a/dist.toml +++ b/dist.toml @@ -1,6 +1,6 @@ [package] name = "purescript-lsp" -version = "1.0.4" +version = "1.0.5" license = "BSD-3-Clause" repository = "https://github.com/OxfordAbstracts/purescript-lsp-bin" binaries = ["purs"] @@ -21,4 +21,4 @@ windows-archive = ".tar.gz" # The archive format to use for non-windows builds (defaults .tar.xz) unix-archive = ".tar.gz" # A namespace to use when publishing this package to the npm registry -npm-scope = "@oxfordabstracts" +npm-scope = "@oxfordabstracts" \ No newline at end of file