Skip to content

Commit

Permalink
Merge pull request #40 from absurdprofit/next
Browse files Browse the repository at this point in the history
Test merge
  • Loading branch information
absurdprofit authored Aug 1, 2024
2 parents 6f628aa + 040fc24 commit a68e9f7
Show file tree
Hide file tree
Showing 144 changed files with 15,151 additions and 23,707 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/gh-pages-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Github Pages Deploy on Merge to Main

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "18.17.0"
cache: "npm"

- name: Cache Node modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: |
npm install
npm install --global lerna # If lerna is not installed globally in your CI environment
- name: Deploy with Lerna
run: npx lerna run deploy
60 changes: 60 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Publish to npm

on:
push:
branches:
- main
- next
- beta
tags:
- "v*"

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

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

- name: Install dependencies
run: npm ci

- name: Get branch name and commit hash
id: git-info
run: |
echo "BRANCH_NAME=${GITHUB_REF_NAME}" >> $GITHUB_ENV
COMMIT_HASH=$(git rev-parse --short HEAD)
echo "COMMIT_HASH=${COMMIT_HASH}" >> $GITHUB_ENV
- name: Conditional Version Update
if: startsWith(env.BRANCH_NAME, 'next') || startsWith(env.BRANCH_NAME, 'beta')
run: |
TAG_NAME=${{ env.BRANCH_NAME }}
COMMIT_HASH=${{ env.COMMIT_HASH }}
lerna list --json | jq -r '.[] | .location' | while read -r package; do
CURRENT_VERSION=$(jq -r '.version' $package/package.json)
NEW_VERSION="${CURRENT_VERSION}-${TAG_NAME}.${COMMIT_HASH}"
jq ".version = \"${NEW_VERSION}\"" $package/package.json > $package/package.json.tmp && mv $package/package.json.tmp $package/package.json
done
- name: Assume unchanged for all package.json files
run: |
git ls-files -m | grep 'package.json' | xargs -I {} git update-index --assume-unchanged {}
- name: Publish packages
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
if [[ "${GITHUB_REF##*/}" == "main" ]]; then
DIST_TAG="latest"
else
DIST_TAG="${GITHUB_REF##*/}"
fi
npx lerna publish from-package --yes --dist-tag $DIST_TAG
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ build
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.vscode
.vscode
.tsbuildinfo
Loading

0 comments on commit a68e9f7

Please sign in to comment.