Skip to content

Merge pull request #32 from usherlabs/fix-order #40

Merge pull request #32 from usherlabs/fix-order

Merge pull request #32 from usherlabs/fix-order #40

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
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: 20
check-latest: true
registry-url: "https://registry.npmjs.org"
- name: Ensure latest npm
run: npm install -g npm@latest
- 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 }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=match,pattern=v(\d+\.\d+\.\d+.*),group=1
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
push: true
tags: |
${{ env.IMAGE_NAME }}:${{ fromJSON(steps.meta.outputs.json).tag-names[0] }}
${{ env.IMAGE_NAME }}:latest