78 lines
1.7 KiB
YAML
78 lines
1.7 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
jobs:
|
|
publish:
|
|
name: Publish package
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
registry-url: https://registry.npmjs.org/
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Build
|
|
run: npm run -s build
|
|
|
|
- name: Test
|
|
run: npm run -s test
|
|
|
|
- name: Docs parity
|
|
run: npm run -s docs:check
|
|
|
|
- name: Type check
|
|
run: npx tsc --noEmit
|
|
|
|
- name: CLI smoke check
|
|
run: |
|
|
node dist/index.js --help
|
|
node dist/index.js plinius --help
|
|
|
|
- name: Publish
|
|
if: ${{ secrets.NPM_TOKEN != '' }}
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
run: |
|
|
CMD="npm"
|
|
"$CMD" publish --access public
|
|
|
|
docker:
|
|
name: Publish Docker image
|
|
runs-on: ubuntu-latest
|
|
needs: publish
|
|
if: ${{ secrets.GITHUB_TOKEN != '' }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Log in to GHCR
|
|
uses: docker/login-action@v4
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and push images
|
|
run: |
|
|
VERSION="${GITHUB_REF_NAME#v}"
|
|
REPO="ghcr.io/${{ github.repository_owner }}/fable-agent"
|
|
docker build -t "$REPO:$VERSION" -t "$REPO:latest" .
|
|
docker push "$REPO:$VERSION"
|
|
docker push "$REPO:latest"
|