Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Build, Test, and npm Publish

on:
push:
paths-ignore:
- "docs/**"
- "*.md"
pull_request:
paths-ignore:
- "docs/**"
- "*.md"

permissions:
contents: write
id-token: write

jobs:
test:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org/'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Lint
run: pnpm lint

- name: Test
run: pnpm test

- name: Build
run: pnpm build

npm-publish:
runs-on: ubuntu-22.04
needs: test
permissions:
contents: write
id-token: write
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org/'
cache: 'pnpm'

- name: Upgrade npm for OIDC support
run: npm install -g npm@latest

- name: Install dependencies
run: pnpm install

- name: Bump Version
id: bump
run: node scripts/bump-version.js

- name: Commit version bump
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add package.json
git commit -m "chore: bump version to ${{ steps.bump.outputs.version }} [skip ci]"

- name: Build
run: pnpm build

- name: Publish to npm with provenance
run: pnpm publish --provenance --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Create git tag and push
run: |
git tag "v${{ steps.bump.outputs.version }}"
git push origin main --follow-tags

- name: Add version to job summary
run: |
echo "# Published Version" >> $GITHUB_STEP_SUMMARY
echo "| Package | Version | Tag |" >> $GITHUB_STEP_SUMMARY
echo "| --- | --- | --- |" >> $GITHUB_STEP_SUMMARY
echo "| @zenuml/codemirror-extensions | v${{ steps.bump.outputs.version }} | [v${{ steps.bump.outputs.version }}](https://github.com/ZenUml/codemirror-extensions/releases/tag/v${{ steps.bump.outputs.version }}) |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "[View on npm](https://www.npmjs.com/package/@zenuml/codemirror-extensions/v/${{ steps.bump.outputs.version }})" >> $GITHUB_STEP_SUMMARY
36 changes: 0 additions & 36 deletions .github/workflows/ci.yml

This file was deleted.

79 changes: 0 additions & 79 deletions .github/workflows/npm-publish.yml

This file was deleted.

38 changes: 20 additions & 18 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading