Skip to content

Merge pull request #102 from usherlabs/release/cex-broker-0.2.38 #78

Merge pull request #102 from usherlabs/release/cex-broker-0.2.38

Merge pull request #102 from usherlabs/release/cex-broker-0.2.38 #78

Workflow file for this run

# .github/workflows/publish.yml
name: Publish
on:
push:
tags:
- 'v[0-9]*.[0-9]*.[0-9]*' # Matches semver tags in the format of v1.2.3
- 'v[0-9]*.[0-9]*.[0-9]*-*' # Matches semver tags in the format of v1.2.3-beta
# Recovery path: republish from a branch when a tag's run failed for
# workflow-only reasons (a rerun executes the workflow file at the tag's
# commit, so a fixed workflow can never rerun under the original tag).
workflow_dispatch:
env:
IMAGE_NAME: ghcr.io/usherlabs/cex-broker
permissions:
contents: read
packages: write
id-token: write
jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Install Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: 1.3.9
- name: Setup Node.js for npm publishing
uses: actions/setup-node@v4
with:
node-version: 24
check-latest: true
registry-url: "https://registry.npmjs.org"
# This package publishes via npm trusted publishing (OIDC, id-token
# permission) — no NPM_TOKEN secret exists. OIDC needs npm >= 11.5.1,
# newer than any runner-bundled npm; without it the placeholder token is
# sent and the registry PUT 404s. Pinned to a major because npm@latest
# broke every tag run when npm 12 dropped the then-pinned Node 20.
- name: Install npm with trusted-publishing support
run: npm install -g npm@12
- name: Install dependencies
run: bun install
- name: Generate protobuf types
run: bun run proto-gen
- name: Run tests
run: bun test
- name: Run Biome lint
run: bunx @biomejs/biome lint .
- name: Build project
run: bun run build
- name: Publish to npm
run: npm publish --provenance --access public
publish-docker:
runs-on: ubuntu-latest
needs: publish-npm
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# The release convention tags the version-bump commit, so package.json
# is the version authority on both tag pushes and dispatch republishes
# (a git-tag-derived name is empty on workflow_dispatch).
- name: Read package version
id: version
run: echo "version=$(jq -r .version package.json)" >> "$GITHUB_OUTPUT"
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
push: true
tags: |
${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}
${{ env.IMAGE_NAME }}:latest