Skip to content

Commit e4f86f8

Browse files
authored
New release and test workflows (#7)
1 parent 9e47a05 commit e4f86f8

File tree

3 files changed

+110
-0
lines changed

3 files changed

+110
-0
lines changed

.github/workflows/release.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Publish Package to NPM
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Run workflow on version tags, e.g. v1.0.0
7+
8+
permissions:
9+
contents: write
10+
packages: write
11+
12+
jobs:
13+
build-and-publish:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0 # Fetch all history for proper versioning
19+
20+
- name: Use Node.js
21+
uses: actions/setup-node@v3
22+
with:
23+
node-version: '20.x'
24+
registry-url: 'https://registry.npmjs.org/'
25+
cache: 'npm'
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Build package
31+
run: npm run build
32+
33+
- name: Run tests
34+
run: npm test
35+
36+
- name: Generate release notes
37+
id: release
38+
run: |
39+
VERSION=${GITHUB_REF#refs/tags/}
40+
echo "version=$VERSION" >> $GITHUB_OUTPUT
41+
# Extract changes from git log or CHANGELOG if available
42+
CHANGES=$(git log --pretty=format:"* %s (%h)" $(git describe --tags --abbrev=0 HEAD^)..HEAD || echo "Initial release")
43+
echo "CHANGES<<EOF" >> $GITHUB_ENV
44+
echo "$CHANGES" >> $GITHUB_ENV
45+
echo "EOF" >> $GITHUB_ENV
46+
47+
- name: Create GitHub Release
48+
uses: softprops/action-gh-release@v1
49+
with:
50+
name: Release ${{ steps.release.outputs.version }}
51+
body: |
52+
## Changes in this release
53+
54+
${{ env.CHANGES }}
55+
56+
For full details, see the [CHANGELOG](https://github.com/lightfeed/browser-agent/blob/main/CHANGELOG.md).
57+
draft: false
58+
prerelease: false
59+
60+
- name: Publish to NPM
61+
run: npm publish --access public
62+
env:
63+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/test.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
schedule:
9+
- cron: '0 0 * * 1' # Run weekly on Monday at midnight UTC
10+
11+
jobs:
12+
unit-tests:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
node-version: [18.x, 20.x]
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
21+
- name: Use Node.js ${{ matrix.node-version }}
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: ${{ matrix.node-version }}
25+
cache: 'npm'
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Run unit tests
31+
run: npm test

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
- Initial release with serverless and remote browser support
12+
- Test and release workflow
13+
14+
### Changed
15+
- Used npm instead of yarn
16+
- Used merge-images instead of sharp (having issue with cross-platform build)

0 commit comments

Comments
 (0)