Skip to content

Commit 623c36f

Browse files
authored
Merge pull request #54 from hackmdio/release/2.6.0
Release 2.6.0
2 parents 17b8a39 + 38cb6cd commit 623c36f

21 files changed

Lines changed: 2594 additions & 21 deletions

.github/workflows/e2e.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Optional live API checks. Add repository secret HACKMD_E2E_ACCESS_TOKEN.
2+
# Optionally add HACKMD_E2E_API_ENDPOINT (e.g. https://api-stage.hackmd.io/v1); otherwise production is used.
3+
4+
name: E2E (live HackMD API)
5+
6+
on:
7+
workflow_dispatch:
8+
9+
jobs:
10+
e2e:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: '20'
19+
cache: 'npm'
20+
cache-dependency-path: nodejs/package-lock.json
21+
22+
- name: Install dependencies
23+
working-directory: nodejs
24+
run: npm ci
25+
26+
- name: Run e2e tests
27+
working-directory: nodejs
28+
env:
29+
HACKMD_ACCESS_TOKEN: ${{ secrets.HACKMD_E2E_ACCESS_TOKEN }}
30+
HACKMD_API_ENDPOINT: ${{ secrets.HACKMD_E2E_API_ENDPOINT }}
31+
run: |
32+
if [ -z "${HACKMD_ACCESS_TOKEN:-}" ]; then
33+
echo "::error::Add repository secret HACKMD_E2E_ACCESS_TOKEN (a valid API token for the target environment)."
34+
exit 1
35+
fi
36+
npm run test:e2e

.github/workflows/publish.yml

Lines changed: 93 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,25 @@ on:
44
push:
55
tags:
66
- 'v*'
7+
branches:
8+
- develop
9+
10+
permissions:
11+
id-token: write # OIDC for npm trusted publishing
12+
contents: write # draft / pre-releases via gh
713

814
jobs:
9-
publish:
15+
publish-release:
16+
name: Release (tag)
17+
if: startsWith(github.ref, 'refs/tags/v')
1018
runs-on: ubuntu-latest
1119
steps:
12-
- uses: actions/checkout@v4
13-
20+
- uses: actions/checkout@v6
21+
1422
- name: Set up Node.js
15-
uses: actions/setup-node@v4
23+
uses: actions/setup-node@v6
1624
with:
17-
node-version: '20'
25+
node-version: '24'
1826
registry-url: 'https://registry.npmjs.org'
1927
cache: 'npm'
2028
cache-dependency-path: nodejs/package-lock.json
@@ -30,5 +38,84 @@ jobs:
3038
- name: Publish to NPM
3139
working-directory: nodejs
3240
run: npm publish --access public
41+
42+
- name: Extract version from tag
43+
run: |
44+
VERSION=${GITHUB_REF#refs/tags/v}
45+
echo "VERSION=$VERSION" >> $GITHUB_ENV
46+
echo "Extracted version: $VERSION"
47+
48+
- name: Create draft release
3349
env:
34-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
50+
GH_TOKEN: ${{ github.token }}
51+
run: |
52+
gh release create "$GITHUB_REF_NAME" \
53+
--title "Release v${VERSION}" \
54+
--draft
55+
56+
publish-prerelease:
57+
name: Pre-release (develop)
58+
if: github.ref == 'refs/heads/develop'
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: actions/checkout@v6
62+
with:
63+
fetch-depth: 0
64+
65+
- name: Set up Node.js
66+
uses: actions/setup-node@v6
67+
with:
68+
node-version: '24'
69+
registry-url: 'https://registry.npmjs.org'
70+
cache: 'npm'
71+
cache-dependency-path: nodejs/package-lock.json
72+
73+
- name: Install dependencies
74+
working-directory: nodejs
75+
run: npm ci
76+
77+
- name: Configure Git
78+
run: |
79+
git config --global user.name "github-actions[bot]"
80+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
81+
82+
- name: Generate pre-release version
83+
working-directory: nodejs
84+
run: |
85+
CURRENT_VERSION=$(node -p "require('./package.json').version")
86+
SHORT_SHA=$(git rev-parse --short HEAD)
87+
TIMESTAMP=$(date +%Y%m%d%H%M%S)
88+
PRE_RELEASE_VERSION="${CURRENT_VERSION}-beta.${TIMESTAMP}.${SHORT_SHA}"
89+
echo "Pre-release version: $PRE_RELEASE_VERSION"
90+
echo "PRE_RELEASE_VERSION=$PRE_RELEASE_VERSION" >> $GITHUB_ENV
91+
npm version $PRE_RELEASE_VERSION --no-git-tag-version
92+
93+
- name: Build
94+
working-directory: nodejs
95+
run: npm run build
96+
97+
- name: Publish pre-release to NPM
98+
working-directory: nodejs
99+
run: npm publish --tag beta --access public
100+
101+
- name: Create GitHub pre-release
102+
env:
103+
GH_TOKEN: ${{ github.token }}
104+
run: |
105+
gh release create "v${PRE_RELEASE_VERSION}" \
106+
--title "Pre-release v${PRE_RELEASE_VERSION}" \
107+
--notes "🚀 **Pre-release from develop branch**
108+
109+
This is an automated pre-release build from the develop branch.
110+
111+
**Changes:**
112+
- Commit: ${{ github.sha }}
113+
- Branch: ${{ github.ref_name }}
114+
115+
**Installation:**
116+
\`\`\`bash
117+
npm install @hackmd/api@beta
118+
\`\`\`
119+
120+
**Note:** This is a pre-release version and may contain unstable features." \
121+
--prerelease

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,27 @@ To run the Node.js example:
3030

3131
The example includes detailed comments and demonstrates best practices for using the HackMD API client.
3232

33+
### Book Mode Conference Note Example
34+
35+
The `examples/book-mode-conference/` directory contains a TypeScript example for creating a "book mode" conference note system:
36+
37+
- **Book Mode Notes**: Creates a master note that links to all session notes
38+
- **Bulk Note Creation**: Automatically creates individual notes for each conference session
39+
- **TypeScript Implementation**: Full type safety with tsx support for direct execution
40+
- **Configurable Templates**: Customizable note templates and conference settings
41+
- **Hierarchical Organization**: Sessions organized by day and time in the main book
42+
- **Error Handling**: Graceful handling of API failures during bulk operations
43+
44+
To run the book mode conference example:
45+
46+
1. Navigate to the example directory: `cd examples/book-mode-conference`
47+
2. Follow the setup instructions in [examples/book-mode-conference/README.md](./examples/book-mode-conference/README.md)
48+
3. Customize the configuration constants and session data
49+
4. Set your HackMD access token
50+
5. Run `npm start`
51+
52+
This example demonstrates advanced usage patterns including bulk operations, team note management, and creating interconnected note structures for conferences or events.
53+
3354
## LICENSE
3455

3556
MIT
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# HackMD Conference Note Generation Environment Variables
2+
3+
# Required: HackMD API Access Token
4+
# Get this from your HackMD instance settings > API tokens
5+
# For hackmd.io: https://hackmd.io/@hackmd-api/developer-portal
6+
HACKMD_ACCESS_TOKEN=your_access_token_here
7+
8+
# Required: HackMD API Endpoint URL
9+
# For hackmd.io: https://api.hackmd.io/v1
10+
# For self-hosted: https://your-hackmd-instance.com/api/v1
11+
HACKMD_API_ENDPOINT=https://api.hackmd.io/v1
12+
13+
# Optional: HackMD Web Domain (for generating correct note URLs)
14+
# This is useful when your API endpoint differs from the web domain
15+
# For hackmd.io: https://hackmd.io
16+
# For self-hosted: https://your-hackmd-instance.com
17+
# If not set, defaults to the API endpoint
18+
HACKMD_WEB_DOMAIN=https://hackmd.io
19+
20+
# Optional: Test Mode
21+
# Set to 'true' to create limited notes for testing
22+
# Set to 'false' or omit for full note generation
23+
TEST_MODE=false
24+
25+
# Optional: Resume Mode
26+
# Set to 'true' to resume from previous interrupted execution
27+
# Set to 'false' or omit for fresh generation
28+
RESUME_MODE=false
29+
30+
# Optional: Fixed delay (milliseconds) between API requests
31+
# Use to avoid rate limits in production environments
32+
# Can also be set via --delay-ms CLI flag
33+
# Recommended: 200-500ms for production
34+
REQUEST_DELAY_MS=0
35+
36+
# Example configurations:
37+
#
38+
# For hackmd.io:
39+
# HACKMD_API_ENDPOINT=https://api.hackmd.io/v1
40+
# HACKMD_WEB_DOMAIN=https://hackmd.io
41+
#
42+
# For self-hosted HackMD:
43+
# HACKMD_API_ENDPOINT=https://your-hackmd.example.com/api/v1
44+
# HACKMD_WEB_DOMAIN=https://your-hackmd.example.com
45+
#
46+
# Production environment example:
47+
# TEST_MODE=false
48+
# REQUEST_DELAY_MS=300
49+
# RESUME_MODE=false

0 commit comments

Comments
 (0)