Skip to content

Version Packages (#94) #117

Version Packages (#94)

Version Packages (#94) #117

Workflow file for this run

name: Release
on:
push:
branches: [main]
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
pull-requests: write
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Setup Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 18.x
- uses: pnpm/action-setup@v3
with:
version: 8
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Create Release PR or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: pnpm release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# ---------- Docker publish to GHCR ----------
- name: Read app version (from packages/ui)
id: ver
run: |
VERSION=$(node -p "require('./packages/ui/package.json').version")
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Set image tags
id: tags
run: |
IMAGE=ghcr.io/${{ github.repository }}
echo "image=$IMAGE" >> $GITHUB_OUTPUT
echo "tags=$IMAGE:latest,$IMAGE:${{ steps.ver.outputs.version }}" >> $GITHUB_OUTPUT
- name: Login 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: Set up Buildx
if: steps.changesets.outputs.published == 'true'
uses: docker/setup-buildx-action@v3
- name: Build and push (multi-arch)
if: steps.changesets.outputs.published == 'true'
uses: docker/build-push-action@v5
with:
context: .
file: packages/docker/Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.tags.outputs.tags }}
labels: |
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.revision=${{ github.sha }}