Skip to content

Version Packages (#1168) #1655

Version Packages (#1168)

Version Packages (#1168) #1655

name: Create Pull Request or Release
on:
push:
branches:
- main
permissions:
contents: write
id-token: write
pull-requests: write
# Publishing the cloud image to GHCR.
packages: write
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v6
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
- uses: pnpm/action-setup@v6
with:
version: 11.3.0
- uses: actions/setup-node@v6
with:
node-version: 24
cache: "pnpm"
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: pnpm install
- name: Build packages
run: |
pnpm build
- name: Build vscode package
run: |
pnpm --filter "hyperbook-studio" vscode:package
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: pnpm release
version: pnpm version-packages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish VS Code extension
if: steps.changesets.outputs.published == 'true'
run: |
pnpm --filter "hyperbook-studio" vscode:publish
pnpm --filter "hyperbook-studio" ovsx:publish
env:
VSCE_PAT: ${{ secrets.VSCE_TOKEN }}
OVSX_PAT: ${{ secrets.OVSX_TOKEN }}
# The cloud platform is private to npm but is published as a container
# image, so self-hosters have something versioned to pull instead of
# tracking main. Runs on the same gate as the other publish steps, after
# changesets has bumped the version in package.json.
- name: Read cloud version
if: steps.changesets.outputs.published == 'true'
id: cloud
run: echo "version=$(node -p "require('./platforms/cloud/package.json').version")" >> "$GITHUB_OUTPUT"
- name: Set up QEMU
if: steps.changesets.outputs.published == 'true'
uses: docker/setup-qemu-action@v3
- name: Set up Buildx
if: steps.changesets.outputs.published == 'true'
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
if: steps.changesets.outputs.published == 'true'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish cloud image
if: steps.changesets.outputs.published == 'true'
uses: docker/build-push-action@v6
with:
context: .
file: platforms/cloud/Dockerfile
# arm64 covers the small boxes schools tend to self-host on.
# better-sqlite3 ships prebuilt binaries for both, so neither is
# compiled under emulation.
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/openpatch/hyperbook-cloud:${{ steps.cloud.outputs.version }}
ghcr.io/openpatch/hyperbook-cloud:latest
cache-from: type=gha
cache-to: type=gha,mode=max