Skip to content

Stop tracking .claude settings (#11) #6

Stop tracking .claude settings (#11)

Stop tracking .claude settings (#11) #6

Workflow file for this run

name: release
on:
push:
tags: ["v*"]
workflow_dispatch:
inputs:
version:
description: "Version to release (x.y.z)"
required: true
type: string
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
cache: npm
- name: Sync version from tag or input
if: startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && github.event.inputs.version != '')
env:
VERSION_INPUT: ${{ github.event.inputs.version }}
run: |
if [[ "${GITHUB_REF_NAME}" == v* ]]; then
version="${GITHUB_REF_NAME#v}"
else
version="${VERSION_INPUT}"
fi
node scripts/sync-version.mjs --version "$version"
- run: npm ci
- run: npm run build
- run: npm test
- name: Package artifacts
run: |
mkdir -p dist-artifacts
tar -czf dist-artifacts/mermkit-packages.tgz packages/*/dist
tar -czf dist-artifacts/mermkit-bindings.tgz bindings
- uses: actions/upload-artifact@v4
with:
name: mermkit-artifacts
path: dist-artifacts
github-release:
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
publish-npm:
runs-on: ubuntu-latest
needs: build
environment: release
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
registry-url: https://registry.npmjs.org
cache: npm
- name: Sync version from tag or input
if: startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && github.event.inputs.version != '')
env:
VERSION_INPUT: ${{ github.event.inputs.version }}
run: |
if [[ "${GITHUB_REF_NAME}" == v* ]]; then
version="${GITHUB_REF_NAME#v}"
else
version="${VERSION_INPUT}"
fi
node scripts/sync-version.mjs --version "$version"
# IMPORTANT for OIDC: npm CLI must be new enough
- run: npm i -g npm@^11.5.1
- run: npm ci
- run: npm run build
- run: npm run publish:npm
env:
NODE_AUTH_TOKEN: ""
NPM_TOKEN: ""
publish-pypi:
runs-on: ubuntu-latest
needs: build
environment: release
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Sync version from tag or input
if: startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && github.event.inputs.version != '')
env:
VERSION_INPUT: ${{ github.event.inputs.version }}
run: |
if [[ "${GITHUB_REF_NAME}" == v* ]]; then
version="${GITHUB_REF_NAME#v}"
else
version="${VERSION_INPUT}"
fi
node scripts/sync-version.mjs --version "$version"
- run: python -m pip install --upgrade pip build
- run: python -m build
working-directory: bindings/python
- uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: bindings/python/dist
publish-crates:
runs-on: ubuntu-latest
needs: build
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
- uses: dtolnay/rust-toolchain@stable
- name: Sync version from tag or input
if: startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && github.event.inputs.version != '')
env:
VERSION_INPUT: ${{ github.event.inputs.version }}
run: |
if [[ "${GITHUB_REF_NAME}" == v* ]]; then
version="${GITHUB_REF_NAME#v}"
else
version="${VERSION_INPUT}"
fi
node scripts/sync-version.mjs --version "$version"
- run: npm run publish:crates
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}