Skip to content

Commit

Permalink
Merge pull request #1 from DIG-Network/release/v0.0.20
Browse files Browse the repository at this point in the history
Release/v0.0.20
  • Loading branch information
MichaelTaylor3D authored Sep 10, 2024
2 parents a64d57e + dfebda6 commit 2ba7515
Show file tree
Hide file tree
Showing 11 changed files with 214 additions and 70 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/auto-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Auto Tag

on:
push:
branches:
- main

concurrency:
group: main-release-check

jobs:
release:
name: release
runs-on: ubuntu-latest
steps:
- name: Clean workspace
uses: Chia-Network/actions/clean-workspace@main

- name: Checkout current branch
uses: actions/checkout@v3
with:
# Need PACKAGE_ADMIN_PAT token so when the tag is created, the tag automation runs
token: ${{ secrets.GH_ACCESS_TOKEN }}
fetch-depth: 0

- name: Set Git identity
run: |
git config --local user.email "automation@michaeltaylor.dev"
git config --local user.name "Automation"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Extract version from package.json
run: |
VERSION=$(jq -r '.version' package.json)
echo "Extracted version: $VERSION"
# Set the version as an output for other steps to use
echo "VERSION=$VERSION" >> $GITHUB_ENV
if git tag --list | grep -q "^$VERSION$"; then
echo "Tag $VERSION already exists, nothing to do."
else
echo "Tag does not exist. Creating and pushing tag."
git tag $VERSION -m "Release $VERSION"
git push origin $VERSION
fi
shell: bash
52 changes: 52 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build and Publish to npm

on:
push:
tags:
- "**"

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}
cancel-in-progress: true

jobs:
build-and-publish:
name: Build and Publish to npm
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.x"

- name: Install Dependencies
run: npm ci

- name: Build Project
run: npm run build

- name: Extract Version and Determine Tag
id: extract-version
run: |
VERSION=$(jq -r '.version' package.json)
if [[ "$VERSION" == *"alpha"* ]]; then
TAG="alpha"
elif [[ "$VERSION" == *"beta"* ]]; then
TAG="beta"
else
TAG="latest"
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "TAG=$TAG" >> $GITHUB_ENV
- name: Publish to npm
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm publish --tag ${{ env.TAG }} --access public
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
47 changes: 47 additions & 0 deletions .github/workflows/ensure-version-increment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This workflow runs on any PRs that are targeting main and ensures that the version in package.json is incremented
name: Check Version Increment

on:
pull_request:
branches:
- 'main'

concurrency:
# SHA is added to the end if on `main` to let all main workflows run
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == 'refs/heads/main' && github.sha || '' }}
cancel-in-progress: true

jobs:
check-version:
name: Check version increment
runs-on: ubuntu-latest
steps:
- uses: Chia-Network/actions/clean-workspace@main

- name: Checkout current branch
uses: actions/checkout@v3
with:
path: branch-repo

- name: Checkout main
uses: actions/checkout@v3
with:
ref: main
path: main-repo

- name: Check Versions
run: |
# Extract version from main branch's package.json
mainVersion=$(jq -r '.version' main-repo/package.json)
echo "Main version: $mainVersion"
# Extract version from current branch's package.json
branchVersion=$(jq -r '.version' branch-repo/package.json)
echo "Branch version: $branchVersion"
# Compare versions
if [ "$branchVersion" == "$mainVersion" ]; then
echo "Version in package.json on this branch is not incremented. Version must increment for a merge to main."
exit 1
fi
shell: bash
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [0.0.20](https://github.com/DIG-Network/DataIntegrityTree/compare/v0.0.18...v0.0.20) (2024-09-10)

### [0.0.19-alpha.0](https://github.com/DIG-Network/DataIntegrityTree/compare/v0.0.18...v0.0.19-alpha.0) (2024-09-10)

### [0.0.18](https://github.com/Datalayer-Storage/DataIntegrityTree/compare/v0.0.17...v0.0.18) (2024-08-20)

### [0.0.17](https://github.com/Datalayer-Storage/DataIntegrityTree/compare/v0.0.16...v0.0.17) (2024-08-20)
Expand Down
45 changes: 0 additions & 45 deletions index.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion index.ts

This file was deleted.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 7 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
{
"name": "dig-data-integrity-tree",
"version": "0.0.18",
"name": "@dignetwork/data-integrity-tree",
"version": "0.0.20",
"description": "Modularized Data Integrity Tree used in the DIG Network Clients.",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"build": "rm -rf dist && tsc && mv index.d.ts dist/",
"build": "rm -rf dist && tsc",
"test": "echo \"Error: no test specified\" && exit 1",
"release": "standard-version",
"postrelease": "npm run build && git push --follow-tags && npm publish"
"prepare-release": "bash ./scripts/release.sh"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Datalayer-Storage/DataIntegrityTree.git"
"url": "git+https://github.com/DIG-Network/DataIntegrityTree.git"
},
"files": [
"dist",
Expand All @@ -28,9 +27,9 @@
"author": "Michael Taylor",
"license": "MIT",
"bugs": {
"url": "https://github.com/Datalayer-Storage/DataIntegrityTree/issues"
"url": "https://github.com/DIG-Network/DataIntegrityTree/issues"
},
"homepage": "https://github.com/Datalayer-Storage/DataIntegrityTree#readme",
"homepage": "https://github.com/DIG-Network/DataIntegrityTree#readme",
"dependencies": {
"crypto-js": "^4.2.0",
"merkletreejs": "^0.4.0",
Expand Down
36 changes: 36 additions & 0 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# Check for uncommitted changes
if ! git diff-index --quiet HEAD --; then
echo "You have uncommitted changes. Please commit or stash them before running this script."
exit 1
fi

# Ensure we're on the develop branch
CURRENT_BRANCH=$(git branch --show-current)
if [ "$CURRENT_BRANCH" != "develop" ]; then
echo "You must be on the 'develop' branch to run this script."
exit 1
fi

# Run standard-version for version bumping
npx standard-version

# Extract the new version from package.json after bumping
NEW_VERSION=$(jq -r '.version' package.json)

# Create a new feature branch based on the new version
FEATURE_BRANCH="release/v$NEW_VERSION"
git checkout -b "$FEATURE_BRANCH"

# Commit changes
git add .
git commit -m "chore(release): bump version to $NEW_VERSION"
git push --set-upstream origin "$FEATURE_BRANCH"

# Notify the user about the feature branch
echo "Version bumped and committed on branch $FEATURE_BRANCH."

git checkout develop

echo "Release PR set to origin on branch $FEATURE_BRANCH."
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './DataIntegrityTree';
31 changes: 17 additions & 14 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"outDir": "./dist",
"rootDir": "./src"
},
"include": ["src/**/*.ts", "src/utils.disabled", "tests/integration/test.ts"],
"exclude": ["node_modules", "dist"]
}

"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"outDir": "./dist",
"rootDir": "./src",
"declaration": true,
"declarationMap": true,
"emitDeclarationOnly": false,
"declarationDir": "./dist"
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules", "dist"]
}

0 comments on commit 2ba7515

Please sign in to comment.