Skip to content

Commit

Permalink
Add cd for next version
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben-Rey committed Jul 8, 2024
1 parent df9f3bb commit 3a33893
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/npm-publish-next.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Npm next publish

on:
push:
branches: [next]

jobs:
test:
uses: ./.github/workflows/tests.yml

publish-npm-dev:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- name: publish
run: ./scripts/publish-next.sh
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
20 changes: 20 additions & 0 deletions scripts/publish-next.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
set -e

npm ci
npm run build
npm version --ws --preid dev --no-git-tag-version --no-commit-hooks prepatch

#Use timestamp as package suffix
TIME=$(date -u +%Y%m%d%H%M%S)
sed -i "/version/s/dev.0/dev.$TIME/g" packages/*/package.json

for packageDir in packages/*; do
if [ -d "$packageDir" ]; then
PACKAGE_NAME=$(cat "$packageDir/package.json" | jq -r '.name')
PUBLISH_VERSION=$(cat "$packageDir/package.json" | jq -r '.version')
echo "Publishing ${PACKAGE_NAME}@${PUBLISH_VERSION}"
fi
done

npm publish --ws --access public --tag ${TAG}next

0 comments on commit 3a33893

Please sign in to comment.