From 4ca1ca5ff6b6e3a7c99e1996a236fd7af1cd87f8 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Thu, 5 Feb 2026 14:08:31 +1100 Subject: [PATCH] prep for release --- .github/workflows/ci.yml | 2 +- .github/workflows/pr-pipeline.yml | 2 +- .github/workflows/release.yml | 49 +++++++++++++++++++++++--- .npmignore | 50 +++++++++++++++++++++++++++ README.md | 57 ++++++++++++++++++++++++++++--- package.json | 17 ++++++--- server.js | 1 + tx/incoming.txt | 0 8 files changed, 162 insertions(+), 16 deletions(-) create mode 100644 .npmignore delete mode 100644 tx/incoming.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c29d95e..0d71154 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v4 with: - node-version: '20' + node-version: '24' cache: 'npm' - name: Install dependencies diff --git a/.github/workflows/pr-pipeline.yml b/.github/workflows/pr-pipeline.yml index 0790def..77252f5 100644 --- a/.github/workflows/pr-pipeline.yml +++ b/.github/workflows/pr-pipeline.yml @@ -17,7 +17,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v4 with: - node-version: '20' + node-version: '24' cache: 'npm' - name: Install dependencies diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1fbc643..8cf70a0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v4 with: - node-version: '20' + node-version: '24' cache: 'npm' - name: Install dependencies @@ -84,11 +84,46 @@ jobs: draft: false prerelease: false token: ${{ secrets.GITHUB_TOKEN }} + +npm-publish: + name: Publish to NPM + runs-on: ubuntu-latest + needs: test + + steps: + - uses: actions/checkout@v4 + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + registry-url: 'https://registry.npmjs.org' + + - name: Install dependencies + run: npm ci - docker: + - name: Get version from tag + id: get_version + run: | + VERSION=${GITHUB_REF#refs/tags/v} + echo "VERSION=$VERSION" >> $GITHUB_OUTPUT + + - name: Update package.json version + run: npm version ${{ steps.get_version.outputs.VERSION }} --no-git-tag-version + + - name: Publish to npm + run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + +docker: name: Build and Push Docker Image runs-on: ubuntu-latest needs: release + permissions: + contents: read + packages: write steps: - uses: actions/checkout@v4 @@ -100,6 +135,9 @@ jobs: echo "VERSION=$VERSION" >> $GITHUB_OUTPUT echo "VERSION_NO_V=${VERSION#v}" >> $GITHUB_OUTPUT + - name: Set lowercase repository name + run: echo "REPO_LC=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -116,10 +154,11 @@ jobs: context: . push: true tags: | - ghcr.io/${{ github.repository }}:latest - ghcr.io/${{ github.repository }}:${{ steps.get_version.outputs.VERSION }} - ghcr.io/${{ github.repository }}:${{ steps.get_version.outputs.VERSION_NO_V }} + ghcr.io/${{ env.REPO_LC }}:latest + ghcr.io/${{ env.REPO_LC }}:${{ steps.get_version.outputs.VERSION }} + ghcr.io/${{ env.REPO_LC }}:${{ steps.get_version.outputs.VERSION_NO_V }} cache-from: type=gha cache-to: type=gha,mode=max build-args: | VERSION=${{ steps.get_version.outputs.VERSION_NO_V }} + \ No newline at end of file diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..914804e --- /dev/null +++ b/.npmignore @@ -0,0 +1,50 @@ +# Development files +.git/ +.github/ +.gitignore +.eslintrc* +.prettierrc* +jest.config.js +nodemon.json + +# Test files +test/ +tests/ +__tests__/ +*.test.js +*.spec.js +test-results/ +coverage/ + +# Data and runtime files +data/ +tx/data/ +logs/ +*.log +*.sqlite + +# Build artifacts +node_modules/ +.npm/ +*.tgz + +# IDE and OS files +.idea/ +.vscode/ +*.swp +*.swo +.DS_Store +Thumbs.db + +# Docker files (not needed for npm) +Dockerfile +docker-compose*.yml +.dockerignore + +# CI/CD +.travis.yml +.circleci/ +azure-pipelines.yml + +# Documentation source (keep compiled) +docs/ diff --git a/README.md b/README.md index 9c164bf..ddbeb13 100644 --- a/README.md +++ b/README.md @@ -197,18 +197,65 @@ hack that. This project follows [Semantic Versioning](https://semver.org/) and uses a [CHANGELOG.md](CHANGELOG.md) file to track changes. -To create a new release: +### What's in a Release -1. Update CHANGELOG.md with your changes under a new version section -2. Commit your changes -3. Tag the commit with the new version: `git tag vX.Y.Z` -4. Push the tag: `git push origin vX.Y.Z` +Each GitHub Release includes: +- **Release notes** extracted from CHANGELOG.md +- **Source code** archives (zip and tar.gz) +- **Docker images** pushed to GitHub Container Registry: + - `ghcr.io/healthintersections/fhirsmith:latest` + - `ghcr.io/healthintersections/fhirsmith:vX.Y.Z` + - `ghcr.io/healthintersections/fhirsmith:X.Y.Z` +- **npm package** published to npmjs.org as `fhirsmith` *(if you add this)* + +### Creating a Release GitHub Actions will automatically: - Run tests - Create a GitHub Release with notes from CHANGELOG.md - Build and publish Docker images with appropriate tags +**Prerequisites:** +- All tests passing on main branch +- CHANGELOG.md updated with changes + +**Steps:** +1. Update `CHANGELOG.md` with your changes under a new version section: +```markdown + ## [vX.Y.Z] - YYYY-MM-DD + ### Added + - New feature description + ### Changed + - Change description + ### Fixed + - Bug fix description +``` + +2. Commit your changes: +```bash + git add CHANGELOG.md + git commit -m "Prepare release vX.Y.Z" + git push origin main +``` + +3. Tag and push the release: +```bash + git tag vX.Y.Z + git push origin vX.Y.Z +``` + +4. Monitor the release: + - Check [GitHub Actions](https://github.com/HealthIntersections/fhirsmith/actions) for the Release workflow + - Verify the [GitHub Release](https://github.com/HealthIntersections/fhirsmith/releases) was created + - Confirm Docker images are available at [GHCR](https://github.com/HealthIntersections/fhirsmith/pkgs/container/fhirsmith) + +**If a release fails:** +- Delete the tag: `git tag -d vX.Y.Z && git push origin :refs/tags/vX.Y.Z` +- Fix the issue +- Re-tag and push + +### Creating a Release + ## License [BSD-3](https://opensource.org/license/bsd-3-clause) diff --git a/package.json b/package.json index d8de08c..cb3dc5d 100644 --- a/package.json +++ b/package.json @@ -98,13 +98,22 @@ "smart-health-link", "smart-health-card" ], - "author": "", - "license": "MIT", + "author": "Health Intersections Pty Ltd", + "license": "BSD-3", "overrides": { "tar": "^7.5.7", "fast-xml-parser": "^5.3.4" }, "bin": { - "tx-import": "./tx-import.js" - } + "tx-import": "./tx-import.js", + "fhirsmith": "./server.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/HealthIntersections/fhirsmith.git" + }, + "bugs": { + "url": "https://github.com/HealthIntersections/fhirsmith/issues" + }, + "homepage": "https://github.com/HealthIntersections/fhirsmith#readme" } \ No newline at end of file diff --git a/server.js b/server.js index b4cb0e3..6655a60 100644 --- a/server.js +++ b/server.js @@ -1,3 +1,4 @@ +#!/usr/bin/env node // // Copyright 2025, Health Intersections Pty Ltd (http://www.healthintersections.com.au) // diff --git a/tx/incoming.txt b/tx/incoming.txt deleted file mode 100644 index e69de29..0000000