Skip to content

Release v1.0.5

Release v1.0.5 #27

Workflow file for this run

name: Publish to npm
on:
push:
tags: ['v*']
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
registry-url: https://registry.npmjs.org
- run: npm ci
- run: npm run typecheck
- run: npm test
- name: Check if version already published
id: check
run: |
LOCAL=$(node -p "require('./package.json').version")
REMOTE=$(npm view @oxgeneral/orch version 2>/dev/null || echo "0.0.0")
if [ "$LOCAL" = "$REMOTE" ]; then
echo "skip=true" >> "$GITHUB_OUTPUT"
echo "Version $LOCAL already published — skipping"
else
echo "skip=false" >> "$GITHUB_OUTPUT"
echo "Publishing $LOCAL (remote has $REMOTE)"
fi
- run: npm publish --access public
if: steps.check.outputs.skip != 'true'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Extract changelog for this version
id: changelog
run: |
VERSION="${GITHUB_REF_NAME#v}"
# Extract section between "## $VERSION" and next "## " or EOF
BODY=$(awk "/^## ${VERSION//./\\.}/{found=1; next} /^## [0-9]/{if(found) exit} found" CHANGELOG.md)
if [ -z "$BODY" ]; then
BODY="Release ${GITHUB_REF_NAME}"
fi
# Write to file to avoid quoting issues
echo "$BODY" > /tmp/release-notes.md
- name: Create GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
run: gh release create "${{ github.ref_name }}" --notes-file /tmp/release-notes.md
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}