diff --git a/.changeset/proud-dots-eat.md b/.changeset/proud-dots-eat.md new file mode 100644 index 0000000..ae7883b --- /dev/null +++ b/.changeset/proud-dots-eat.md @@ -0,0 +1,5 @@ +--- +"typedoc-plugin-mermaid": minor +--- + +Update CI/CD Workflow diff --git a/.github/actions/setup.yaml b/.github/actions/setup.yaml new file mode 100644 index 0000000..6cff3c6 --- /dev/null +++ b/.github/actions/setup.yaml @@ -0,0 +1,13 @@ +name: Setup Action +description: Composite Setup Action +runs: + using: composite + steps: + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 + - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + with: + node-version-file: ./.node-version + cache: pnpm + - name: Install Dependencies + run: pnpm install --frozen-lockfile diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml deleted file mode 100644 index 083b3e6..0000000 --- a/.github/release-drafter.yml +++ /dev/null @@ -1,22 +0,0 @@ -name-template: v$NEXT_PATCH_VERSION 🌈 -tag-template: v$NEXT_PATCH_VERSION -categories: - - title: 🚀 Features - labels: - - feature - - enhancement - - title: 🐛 Bug Fixes - labels: - - fix - - bugfix - - bug - - title: 🧰 Maintenance - labels: - - chore - - docs - - doc -change-template: '- $TITLE @$AUTHOR (#$NUMBER)' -template: | - ## Changes - - $CHANGES diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml new file mode 100644 index 0000000..f63ac6e --- /dev/null +++ b/.github/workflows/cicd.yaml @@ -0,0 +1,108 @@ +name: CI/CD +on: + push: + branches: + - main + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + check_format: + name: Check format + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Setup + uses: ./.github/actions/setup.yaml + - name: Check format + run: pnpm lint + env: + CI: true + + check_type: + name: Check type + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Setup + uses: ./.github/actions/setup.yaml + - name: Check type + run: pnpm typecheck + env: + CI: true + + build: + name: Build + runs-on: ubuntu-latest + permissions: + contents: read + needs: + - check_format + - check_type + steps: + - name: Setup + uses: ./.github/actions/setup.yaml + - name: Build + run: pnpm build + env: + CI: true + - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + with: + name: dist + path: dist + test: + name: Test on node ${{ matrix.node-version }} and ${{ matrix.os }} + needs: + - check_format + - check_type + runs-on: ${{ matrix.os }} + strategy: + matrix: + node-version: [16.x, 18.x, 20.x, 22.x] + os: [ubuntu-latest, macos-latest, windows-latest] + permissions: + contents: read + steps: + - name: Setup + uses: ./.github/actions/setup.yaml + - name: Test + run: pnpm test + env: + CI: true + + release: + name: Release + runs-on: ubuntu-latest + needs: + - build + - test + # if repository is github.com/kamiazya/typedoc-plugin-mermaid + # and branch is main + # and before job is successful + # then run this job + if: ${{ github.repository == 'kamiazya/typedoc-plugin-mermaid' && github.ref == 'refs/heads/main' && github.event_name == 'push' && needs.build.result == 'success' && needs.test.result == 'success' }} + permissions: + contents: write # Used to commit to "Version Packages" PR + pull-requests: write # Used to create "Version Packages" PR + id-token: write # Used to publish to npm with provenance statements + # Other permissions are defaulted to none + steps: + - name: Setup + uses: ./.github/actions/setup.yaml + - name: Create Release Pull Request or Publish to npm + id: changesets + uses: changesets/action@aba318e9165b45b7948c60273e0b72fce0a64eb9 # v1.4.7 + with: + publish: pnpm exec changeset publish + version: pnpm exec changeset version + createGithubReleases: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + outputs: + published: ${{ steps.changesets.outputs.published }} diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml deleted file mode 100644 index 5f5995a..0000000 --- a/.github/workflows/nodejs.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: Node CI - -on: [push] - -jobs: - tests: - name: Test on node ${{ matrix.node-version }} and ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - node-version: [14.x, 16.x, 18.x] - os: [ubuntu-latest, macos-latest] - - steps: - - uses: actions/checkout@v1 - - name: Use Node.js ${{ matrix.node-version }} on ${{ matrix.os }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - name: Install dependencies - run: yarn --frozen-lockfile --ignore-optional - env: - CI: true - - name: Lint - run: yarn lint - env: - CI: true - - name: Test - run: yarn test - - name: Build - run: yarn build - env: - CI: true - - publish: - name: Publish to NPM - runs-on: ubuntu-latest - needs: - - tests - steps: - - uses: actions/checkout@master - - uses: actions/setup-node@v1 - with: - node-version: 16.x - registry-url: https://registry.npmjs.org - - name: install global module - run: | - npm install -g yarn - if: contains(github.ref, 'tags/v') - - name: Install dependencies - run: yarn install --frozen-lockfile --ignore-optional - if: contains(github.ref, 'tags/v') - env: - CI: true - - name: Build - run: yarn build - if: contains(github.ref, 'tags/v') - - name: Publish to NPM - run: npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} - if: contains(github.ref, 'tags/v') diff --git a/.github/workflows/release-management.yml b/.github/workflows/release-management.yml deleted file mode 100644 index 90d2107..0000000 --- a/.github/workflows/release-management.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Release Management - -on: - push: - # branches to consider in the event; optional, defaults to all - branches: - - main - -jobs: - update_draft_release: - runs-on: ubuntu-latest - steps: - # Drafts your next Release notes as Pull Requests are merged into "main" - - uses: toolmantim/release-drafter@v5 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/typedoc-ci.yml b/.github/workflows/typedoc-ci.yml deleted file mode 100644 index 3797ce7..0000000 --- a/.github/workflows/typedoc-ci.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Typedoc CI - -on: [push] - -jobs: - tests: - name: TypeDoc integration - runs-on: ubuntu-latest - strategy: - fail-fast: False - matrix: - typedoc-version: - - latest - - '~0.22.0' - steps: - - uses: actions/checkout@v1 - - name: Use Node.js - uses: actions/setup-node@v1 - with: - node-version: 14.x - - name: Install dependencies - run: yarn --frozen-lockfile --ignore-optional - env: - CI: true - - name: Build - run: yarn build - env: - CI: true - - name: Link - run: yarn link - - name: TypeDoc integration test - run: | - cd ~ && mkdir -p example/src && cd example - yarn init -y - yarn add -D typescript typedoc@${{ matrix.typedoc-version }} - echo '{"compilerOptions": {"target": "es5","module": "commonjs","lib": ["es2015"],"strict": true,"esModuleInterop": true,"forceConsistentCasingInFileNames": true}}' >> tsconfig.json - echo 'export class HelloWorld {}' >> src/hello-world.ts - yarn link typedoc-plugin-mermaid - yarn run typedoc --plugin typedoc-plugin-mermaid \ - --out docs \ - src/hello-world.ts diff --git a/.node-version b/.node-version new file mode 100644 index 0000000..209e3ef --- /dev/null +++ b/.node-version @@ -0,0 +1 @@ +20