Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 1 addition & 20 deletions .github/workflows/npm-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
push:
branches:
- main

jobs:
release:
if: ${{ github.ref == 'refs/heads/main' && !startsWith(github.event.head_commit.message, 'NPM Package Release') }}
Expand All @@ -19,23 +18,19 @@ jobs:
ssh-key: ${{ secrets.PUBLISH_PRIVATE_KEY }}
submodules: recursive
fetch-depth: 0

- uses: DeterminateSystems/nix-installer-action@main
with:
determinate: true
- uses: DeterminateSystems/flakehub-cache-action@main

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "24.x"
registry-url: "https://registry.npmjs.org"

- name: Upgrade npm for OIDC
run: |
npm install -g npm@latest
npm --version

- name: Verify OIDC availability
run: |
if [ -n "${ACTIONS_ID_TOKEN_REQUEST_URL}" ] && [ -n "${ACTIONS_ID_TOKEN_REQUEST_TOKEN}" ]; then
Expand All @@ -46,7 +41,6 @@ jobs:
echo "Check workflow permissions include 'id-token: write'"
exit 1
fi

- name: Verify repository configuration
run: |
echo "Checking repository consistency..."
Expand All @@ -60,31 +54,24 @@ jobs:
exit 1
fi
echo "Repositories match"

- run: nix develop -c build-submodules

- run: nix develop -c local-bundle

- name: Install Playwright browsers with dependencies
run: |
cd svelte-test
npx playwright install --with-deps

- name: Test full integration
run: nix develop -c test-full-integration

- name: Git Config
run: |
git config --global user.email "${{ secrets.CI_GIT_EMAIL }}"
git config --global user.name "${{ secrets.CI_GIT_USER }}"

# get hash of latest published pkgs from npm and concat them
- name: Get Old Hash
run: |
OLD_HASH=$(npm view @rainlanguage/sqlite-web dist.shasum 2>/dev/null || echo "none")
echo "OLD_HASH=$OLD_HASH" >> $GITHUB_ENV
echo "old hash: $OLD_HASH"

# Build the package and calc hash
- name: Build and Get New Hash
run: |
Expand All @@ -93,7 +80,6 @@ jobs:
echo "NEW_HASH=$NEW_HASH" >> $GITHUB_ENV
echo "new hash: $NEW_HASH"
rm -f pkg/*.tgz

# from here on, we'll skip if OLD_HASH and NEW_HASH are the same (ie no publish)
# this means we need to skip every step by using an if statement.
# set npm version in pkg directory
Expand All @@ -107,34 +93,30 @@ jobs:
sed -i.bak "s/^version = \".*\"/version = \"$NEW_VERSION\"/" "$manifest"
rm "$manifest".bak
done

nix develop -c taplo fmt packages/sqlite-web/Cargo.toml packages/sqlite-web-core/Cargo.toml
# Create sqlite-web npm package tarball
- name: Create sqlite-web NPM Package Tarball
if: ${{ env.OLD_HASH != env.NEW_HASH }}
run: |
cd pkg
echo "NPM_PACKAGE=$(npm pack --silent)" >> $GITHUB_ENV

- name: Rename sqlite-web NPM Package Tarball
if: ${{ env.OLD_HASH != env.NEW_HASH }}
run: mv pkg/${{ env.NPM_PACKAGE }} sqlite_web_npm_package_${{ env.NEW_VERSION }}.tgz

# publish sqlite-web pkg to npm
- name: Publish sqlite-web pkg To NPM
if: ${{ env.OLD_HASH != env.NEW_HASH }}
run: |
npm publish sqlite_web_npm_package_${{ env.NEW_VERSION }}.tgz \
--access public \
--verbose

# Commit changes and tag
- name: Commit And Tag
if: ${{ env.OLD_HASH != env.NEW_HASH }}
run: |
git add pkg/package.json packages/sqlite-web/Cargo.toml packages/sqlite-web-core/Cargo.toml
git commit -m "NPM Package Release v${{ env.NEW_VERSION }}"
git tag npm-v${{ env.NEW_VERSION }}

# Push the commit to remote
- name: Push Changes To Remote
if: ${{ env.OLD_HASH != env.NEW_HASH }}
Expand All @@ -143,7 +125,6 @@ jobs:
git push -u origin npm-v${{ env.NEW_VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Create gitHub release with tarballs
- name: Create GitHub Release with sqlite-web pkg
if: ${{ env.OLD_HASH != env.NEW_HASH }}
Expand Down
2 changes: 1 addition & 1 deletion packages/sqlite-web-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ serde-wasm-bindgen = { workspace = true }
uuid = { workspace = true }
console_error_panic_hook = { workspace = true }
sqlite-wasm-rs = { workspace = true }
rain-math-float = { path = "../../lib/rain.math.float/crates/float"}
rain-math-float = { path = "../../lib/rain.math.float/crates/float" }
alloy = { workspace = true }
base64 = { workspace = true }

Expand Down
Loading