Skip to content

Auto-publish libsql-server updates #79

Auto-publish libsql-server updates

Auto-publish libsql-server updates #79

Workflow file for this run

name: Auto-publish libsql-server updates
on:
schedule:
- cron: '0 9 * * *' # Run daily at 9 AM UTC
workflow_dispatch: # Allow manual triggering
push:
branches: [main]
paths:
- 'scripts/**'
- '.github/workflows/**'
jobs:
check-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'
- name: Check for new version
id: check-version
run: |
if node scripts/check-version.js; then
echo "new-version=true" >> $GITHUB_OUTPUT
else
echo "new-version=false" >> $GITHUB_OUTPUT
fi
continue-on-error: true
- name: Extract binaries
if: steps.check-version.outputs.new-version == 'true'
run: node scripts/extract-binaries.js
- name: Test binaries
if: steps.check-version.outputs.new-version == 'true'
run: node scripts/test.js
- name: Get version
if: steps.check-version.outputs.new-version == 'true'
id: get-version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Commit updated binaries
if: steps.check-version.outputs.new-version == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "vltops"
git add packages/*/sqld packages/*/package.json package.json
git commit -m "Update to latest libsql-server release" || exit 0
git push
- name: Publish to npm
if: steps.check-version.outputs.new-version == 'true'
run: npm publish --force --ws --iwr --tag latest --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create GitHub Release
if: steps.check-version.outputs.new-version == 'true'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
tag_name: ${{ steps.get-version.outputs.version }}
release_name: Release ${{ steps.get-version.outputs.version }}
body: |
Automated release of libsql-server ${{ steps.get-version.outputs.version }}
This release includes platform-specific binaries for:
- macOS ARM64 (@sqld/darwin-arm64)
- macOS x64 (@sqld/darwin-x64)
- Linux ARM64 (@sqld/linux-arm64)
- Linux x64 (@sqld/linux-x64)
draft: false
prerelease: false