Skip to content
Open
165 changes: 165 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
name: Release Package

on:
workflow_dispatch:
inputs:
package:
description: 'Package to release'
required: true
type: choice
options:
- core
- dzi
- geometry
- omezarr
- web-components

permissions:
contents: write
packages: write
pull-requests: write

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}

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

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9.14.2

- name: Install dependencies
run: pnpm install

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

# Set the remote URL to use the token for pushing
git remote set-url origin https://x-access-token:${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git

- name: Get current version and determine next version
id: version_info
run: |
cd packages/${{ github.event.inputs.package }}

# Get current version
CURRENT_VERSION=$(node -p "require('./package.json').version")
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT

# Use git-cliff to determine the next version
TAG_PATTERN="@alleninstitute/vis-${{ github.event.inputs.package }}@*"
NEXT_VERSION=$(npx git-cliff --tag-pattern "$TAG_PATTERN" --bumped-version)

# Extract just the version number (remove the tag prefix)
NEXT_VERSION=$(echo "$NEXT_VERSION" | sed 's/.*@//')

echo "next_version=$NEXT_VERSION" >> $GITHUB_OUTPUT
echo "Current version: $CURRENT_VERSION"
echo "Next version: $NEXT_VERSION"

- name: Update version number and create initial tag
run: |
cd packages/${{ github.event.inputs.package }}
# npm version creates a commit and a tag for us
npm version ${{ steps.version_info.outputs.next_version }} --no-git-tag-version=false

- name: Generate changelog
run: |
cd packages/${{ github.event.inputs.package }}
pnpm run changelog

- name: Amend commit with changelog
run: |
cd packages/${{ github.event.inputs.package }}
git add changelog.md
git commit --amend --no-edit

- name: Delete the tag created by npm version and create new one
id: create_tag
run: |
cd packages/${{ github.event.inputs.package }}
TAG_NAME="@alleninstitute/vis-${{ github.event.inputs.package }}@${{ steps.version_info.outputs.next_version }}"

# Delete the tag created by npm version (it would be just the version number)
git tag -d v${{ steps.version_info.outputs.next_version }} || true

# Create a new tag with our naming convention on the amended commit
git tag -a "$TAG_NAME" -m "Release $TAG_NAME"
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT

- name: Create release branch and push changes
run: |
BRANCH_NAME="release/${{ github.event.inputs.package }}-v${{ steps.version_info.outputs.next_version }}"
git checkout -b "$BRANCH_NAME"
git push origin "$BRANCH_NAME"

- name: Create Pull Request
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
script: |
const { data: pullRequest } = await github.rest.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: `Release ${{ github.event.inputs.package }} v${{ steps.version_info.outputs.next_version }}`,
head: `release/${{ github.event.inputs.package }}-v${{ steps.version_info.outputs.next_version }}`,
base: 'main',
body: `Automated release for @alleninstitute/vis-${{ github.event.inputs.package }} v${{ steps.version_info.outputs.next_version }}\n\nSee [CHANGELOG](./packages/${{ github.event.inputs.package }}/changelog.md) for details.`
});

// Auto-merge if you have that enabled
await github.rest.pulls.merge({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pullRequest.number,
merge_method: 'squash'
});

- name: Push tag after merge
run: |
# Wait a moment for the merge to complete
sleep 5
git checkout main
git pull origin main
git push origin ${{ steps.create_tag.outputs.tag_name }}

- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.create_tag.outputs.tag_name }}
release_name: "${{ github.event.inputs.package }} v${{ steps.version_info.outputs.next_version }}"
body: |
Release of @alleninstitute/vis-${{ github.event.inputs.package }} v${{ steps.version_info.outputs.next_version }}

See [CHANGELOG](./packages/${{ github.event.inputs.package }}/changelog.md) for details.
draft: false
prerelease: false

- name: Publish to GitHub Packages (if needed)
run: |
cd packages/${{ github.event.inputs.package }}
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > .npmrc
echo "@alleninstitute:registry=https://npm.pkg.github.com" >> .npmrc

# Build the package first
pnpm run build

# Publish to GitHub Packages
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions cliff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ All notable changes to this project will be documented in this file.\n
# https://keats.github.io/tera/docs/#introduction
body = """
{% if version %}\
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
## [{{ version | trim_start_matches(pat="@alleninstitute/vis-") | trim_start_matches(pat="@") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\
## [unreleased]
{% endif %}\
Expand Down Expand Up @@ -48,7 +48,7 @@ postprocessors = [
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true
# filter out the commits that are not conventional
filter_unconventional = true
filter_unconventional = false
# process each line of a commit as an individual commit
split_commits = false
# regex for preprocessing the commit messages
Expand Down
53 changes: 53 additions & 0 deletions packages/core/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Changelog

All notable changes to this project will be documented in this file.

## [alleninstitute/core@0.0.4] - 2025-07-14

### 🚀 Features

- Starlight Docs and Example Site ([#157](https://github.com/AllenInstitute/vis/pull/157))

### 🐛 Bug Fixes

- Color parsing supports hex strings without hash [135] ([#138](https://github.com/AllenInstitute/vis/pull/138))
- Export Logger class and raise default log level ([#160](https://github.com/AllenInstitute/vis/pull/160))

### 💼 Other

- A priority cache with a (better?) api ([#171](https://github.com/AllenInstitute/vis/pull/171))

Co-authored-by: Lane Sawyer <lane.sawyer@alleninstitute.org>

### ⚙️ Miscellaneous Tasks

- Add helpful linting rules ([#127](https://github.com/AllenInstitute/vis/pull/127))
- *(deps)* Bump @types/lodash from 4.14.202 to 4.17.16 ([#153](https://github.com/AllenInstitute/vis/pull/153))
- *(deps)* Bump @types/lodash from 4.17.16 to 4.17.17 ([#168](https://github.com/AllenInstitute/vis/pull/168))
- Dev command, reorganized docs, added stubs ([#163](https://github.com/AllenInstitute/vis/pull/163))
- *(deps)* Bump @types/lodash from 4.17.17 to 4.17.19 ([#177](https://github.com/AllenInstitute/vis/pull/177))
- *(deps)* Bump @biomejs/biome from 1.9.4 to 2.0.6 ([#174](https://github.com/AllenInstitute/vis/pull/174))

## [alleninstitute/core@0.0.3] - 2025-04-23

### 💼 Other

- Noah/webworker decoders ([#126](https://github.com/AllenInstitute/vis/pull/126))

## [alleninstitute/core@0.0.2] - 2025-04-08

### 🚀 Features

- Support for arbitrary color channels in OME-Zarr images [DC-530] ([#123](https://github.com/AllenInstitute/vis/pull/123))

### ⚙️ Miscellaneous Tasks

- Updates to package versions for Core, Geometry, OmeZarr + examples [DC-530] ([#124](https://github.com/AllenInstitute/vis/pull/124))

## [alleninstitute/core@0.0.1] - 2025-04-04

### ⚙️ Miscellaneous Tasks

- Rename vis-scatterbrain package to vis-core ([#118](https://github.com/AllenInstitute/vis/pull/118))

<!-- generated by git-cliff -->
3 changes: 2 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
"dev": "parcel watch --port 1235",
"test": "vitest --watch",
"test:ci": "vitest run",
"coverage": "vitest run --coverage"
"coverage": "vitest run --coverage",
"changelog": "git-cliff -o changelog.md --tag-pattern @alleninstitute/vis-core@*"
},
"repository": {
"type": "git",
Expand Down
73 changes: 61 additions & 12 deletions packages/dzi/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,35 @@ All notable changes to this project will be documented in this file.

- DZI fetch function ([#162](https://github.com/AllenInstitute/vis/pull/162))

### ⚙️ Miscellaneous Tasks

- Add helpful linting rules ([#127](https://github.com/AllenInstitute/vis/pull/127))
- Dev command, reorganized docs, added stubs ([#163](https://github.com/AllenInstitute/vis/pull/163))
- *(deps)* Bump @biomejs/biome from 1.9.4 to 2.0.6 ([#174](https://github.com/AllenInstitute/vis/pull/174))
- Add Changelogs ([#117](https://github.com/AllenInstitute/vis/pull/117))

## [alleninstitute/dzi@0.0.11] - 2025-04-08

### 💼 Other

- Updating DZI package version (remove Scatterbrain dependency) ([#125](https://github.com/AllenInstitute/vis/pull/125))

### ⚙️ Miscellaneous Tasks

- Rename vis-scatterbrain package to vis-core ([#118](https://github.com/AllenInstitute/vis/pull/118))

## [alleninstitute/dzi@0.0.10] - 2025-03-31

### ⚙️ Miscellaneous Tasks

- Logger with log levels ([#97](https://github.com/AllenInstitute/vis/pull/97))
- Test coverage tooling ([#95](https://github.com/AllenInstitute/vis/pull/95))
- Updating vis-dzi and vis-omezarr to enable use of vis-scatterbrain 0.0.10 ([#112](https://github.com/AllenInstitute/vis/pull/112))

## [alleninstitute/dzi@0.0.9] - 2025-03-14

### 🐛 Bug Fixes

- Dzi viewer would loop forever due to some faulty math ([#43](https://github.com/AllenInstitute/vis/pull/43))
- CI tests weren't running [DT-7060] ([#87](https://github.com/AllenInstitute/vis/pull/87))

### 💼 Other
Expand All @@ -19,21 +45,44 @@ All notable changes to this project will be documented in this file.

### ⚙️ Miscellaneous Tasks

- CI workflow [DT-5996] ([#25](https://github.com/AllenInstitute/vis/pull/25))
- Update version ([#39](https://github.com/AllenInstitute/vis/pull/39))
- Remove only-allow so builds stop failing ([#47](https://github.com/AllenInstitute/vis/pull/47))
- Version bumps for only-allow removal release ([#51](https://github.com/AllenInstitute/vis/pull/51))
- Install Biome, fix formatting [DT-7060] ([#52](https://github.com/AllenInstitute/vis/pull/52))
- Biome linting with auto-fixes [DT-7060] ([#53](https://github.com/AllenInstitute/vis/pull/53))
- Dependency health configurations ([#17](https://github.com/AllenInstitute/vis/pull/17))
- Clean up dependencies [DT-7060] ([#55](https://github.com/AllenInstitute/vis/pull/55))
- Fix all but non-null assertion lints ([#96](https://github.com/AllenInstitute/vis/pull/96))
- Logger with log levels ([#97](https://github.com/AllenInstitute/vis/pull/97))
- Test coverage tooling ([#95](https://github.com/AllenInstitute/vis/pull/95))
- Updating vis-dzi and vis-omezarr to enable use of vis-scatterbrain 0.0.10 ([#112](https://github.com/AllenInstitute/vis/pull/112))
- Rename vis-scatterbrain package to vis-core ([#118](https://github.com/AllenInstitute/vis/pull/118))
- Add helpful linting rules ([#127](https://github.com/AllenInstitute/vis/pull/127))
- Dev command, reorganized docs, added stubs ([#163](https://github.com/AllenInstitute/vis/pull/163))
- *(deps)* Bump @biomejs/biome from 1.9.4 to 2.0.6 ([#174](https://github.com/AllenInstitute/vis/pull/174))

## [alleninstitute/dzi@0.0.7] - 2025-02-03

### ⚙️ Miscellaneous Tasks

- Remove only-allow so builds stop failing ([#47](https://github.com/AllenInstitute/vis/pull/47))
- Version bumps for only-allow removal release ([#51](https://github.com/AllenInstitute/vis/pull/51))

## [alleninstitute/dzi@0.0.6] - 2024-12-04

### 💼 Other

- Noah/documentation ([#46](https://github.com/AllenInstitute/vis/pull/46))

## [alleninstitute/dzi@0.0.5] - 2024-11-21

### 🐛 Bug Fixes

- Dzi viewer would loop forever due to some faulty math ([#43](https://github.com/AllenInstitute/vis/pull/43))

## [alleninstitute/dzi@0.0.4] - 2024-11-13

### ⚙️ Miscellaneous Tasks

- CI workflow [DT-5996] ([#25](https://github.com/AllenInstitute/vis/pull/25))
- Update version ([#39](https://github.com/AllenInstitute/vis/pull/39))

## [alleninstitute/dzi@0.0.3] - 2024-10-02

### 💼 Other

- DZI viewer component ([#29](https://github.com/AllenInstitute/vis/pull/29))

Co-authored-by: Lane Sawyer <lane.sawyer@alleninstitute.org>

<!-- generated by git-cliff -->
2 changes: 1 addition & 1 deletion packages/dzi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"test": "vitest --watch",
"test:ci": "vitest run",
"coverage": "vitest run --coverage",
"changelog": "git-cliff -o changelog.md"
"changelog": "git-cliff -o changelog.md --tag-pattern @alleninstitute/vis-dzi@*"
},
"repository": {
"type": "git",
Expand Down
Loading