Skip to content
Merged
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
63 changes: 63 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Generate Documentation

on:
push:
branches:
- master

permissions:
contents: write
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
generate-docs:
runs-on: ubuntu-latest

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

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Setup Yarn
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Enable Corepack
run: corepack enable

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Generate documentation
run: yarn docs

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './docs'

deploy:
runs-on: ubuntu-latest
needs: generate-docs
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
permissions:
pages: write
id-token: write

steps:
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4

110 changes: 110 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Build and Publish

on:
push:
branches:
- master

jobs:
build-and-publish:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://npm.pkg.github.com'
scope: '@${{ github.repository_owner }}'

- name: Setup Yarn
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Enable Corepack
run: corepack enable

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Build project
run: yarn build

- name: Publish to GitHub Packages
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Get version from package.json
VERSION=$(node -p "require('./package.json').version")

# Remove 'v' prefix if present
VERSION=${VERSION#v}

# Update package.json version
npm version $VERSION --no-git-tag-version

# Configure npm authentication for GitHub Packages
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc

# Publish
npm publish

- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Get version from package.json (before restoring original name)
VERSION=$(node -p "require('./package.json').version")
VERSION=${VERSION#v}
TAG_NAME="v$VERSION"

# Configure git
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"

# Create git tag if it doesn't exist
if ! git rev-parse "$TAG_NAME" >/dev/null 2>&1; then
git tag "$TAG_NAME"
git push origin "$TAG_NAME"
fi

# Create GitHub release using GitHub API
RELEASE_RESPONSE=$(curl -s -w "\n%{http_code}" -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/releases" \
-d "{\"tag_name\":\"$TAG_NAME\",\"name\":\"$TAG_NAME\",\"body\":\"Release $TAG_NAME\",\"draft\":false,\"prerelease\":false}")

HTTP_CODE=$(echo "$RELEASE_RESPONSE" | tail -n1)
if [ "$HTTP_CODE" = "201" ]; then
echo "Release $TAG_NAME created successfully"
elif [ "$HTTP_CODE" = "422" ]; then
echo "Release $TAG_NAME already exists"
else
echo "Failed to create release. HTTP code: $HTTP_CODE"
echo "$RELEASE_RESPONSE"
fi

- name: Increment version
run: |
# Configure git
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"

# Increment patch version
npm version patch --no-git-tag-version

# Commit and push version increment
git add package.json
git commit -m "chore: increment version after release"
git push

41 changes: 41 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Test

on:
pull_request:
branches:
- main
- master

jobs:
test:
runs-on: ubuntu-latest

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

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Setup Yarn
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Enable Corepack
run: corepack enable

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Run linter
run: yarn lint

- name: Compile TypeScript
run: yarn compile

- name: Run tests
run: yarn test

9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "sequency",
"name": "@kraken-crypto/sequency",
"version": "0.20.0",
"description": "Functional sequences for processing iterable data in JavaScript",
"main": "./lib/cjs/sequency.js",
Expand Down Expand Up @@ -34,10 +34,10 @@
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/winterbe/sequency.git"
"url": "https://github.com/Kraken-crypto/sequency.git"
},
"bugs": {
"url": "https://github.com/winterbe/sequency/issues"
"url": "https://github.com/Kraken-crypto/sequency/issues"
},
"files": [
"lib",
Expand All @@ -46,6 +46,9 @@
"engines": {
"node": ">=6.0.0"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com"
},
"packageManager": "yarn@4.1.1",
"devDependencies": {
"@size-limit/preset-small-lib": "^11.1.2",
Expand Down
42 changes: 21 additions & 21 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,27 @@ __metadata:
languageName: node
linkType: hard

"@kraken-crypto/sequency@workspace:.":
version: 0.0.0-use.local
resolution: "@kraken-crypto/sequency@workspace:."
dependencies:
"@size-limit/preset-small-lib": "npm:^11.1.2"
"@types/jest": "npm:^29.5.12"
gh-pages: "npm:^6.1.1"
jest: "npm:^29.7.0"
rimraf: "npm:^5.0.5"
size-limit: "npm:^11.1.2"
terser-webpack-plugin: "npm:^5.3.10"
ts-jest: "npm:^29.1.2"
ts-loader: "npm:^9.5.1"
tslint: "npm:^6.1.3"
typedoc: "npm:^0.25.12"
typescript: "npm:^5.4.3"
webpack: "npm:^5.91.0"
webpack-cli: "npm:^5.1.4"
languageName: unknown
linkType: soft

"@nodelib/fs.scandir@npm:2.1.5":
version: 2.1.5
resolution: "@nodelib/fs.scandir@npm:2.1.5"
Expand Down Expand Up @@ -4361,27 +4382,6 @@ __metadata:
languageName: node
linkType: hard

"sequency@workspace:.":
version: 0.0.0-use.local
resolution: "sequency@workspace:."
dependencies:
"@size-limit/preset-small-lib": "npm:^11.1.2"
"@types/jest": "npm:^29.5.12"
gh-pages: "npm:^6.1.1"
jest: "npm:^29.7.0"
rimraf: "npm:^5.0.5"
size-limit: "npm:^11.1.2"
terser-webpack-plugin: "npm:^5.3.10"
ts-jest: "npm:^29.1.2"
ts-loader: "npm:^9.5.1"
tslint: "npm:^6.1.3"
typedoc: "npm:^0.25.12"
typescript: "npm:^5.4.3"
webpack: "npm:^5.91.0"
webpack-cli: "npm:^5.1.4"
languageName: unknown
linkType: soft

"serialize-javascript@npm:^6.0.1":
version: 6.0.2
resolution: "serialize-javascript@npm:6.0.2"
Expand Down