Skip to content

Commit

Permalink
Update CI/CD Workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kamiazya committed Jun 12, 2024
1 parent 38fec36 commit 2cbd6ee
Show file tree
Hide file tree
Showing 8 changed files with 127 additions and 141 deletions.
5 changes: 5 additions & 0 deletions .changeset/proud-dots-eat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"typedoc-plugin-mermaid": minor
---

Update CI/CD Workflow
13 changes: 13 additions & 0 deletions .github/actions/setup/action.yaml
Original file line number Diff line number Diff line change
@@ -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
22 changes: 0 additions & 22 deletions .github/release-drafter.yml

This file was deleted.

108 changes: 108 additions & 0 deletions .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
@@ -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
- 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
- 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
- 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
- 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
- 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 }}
62 changes: 0 additions & 62 deletions .github/workflows/nodejs.yml

This file was deleted.

16 changes: 0 additions & 16 deletions .github/workflows/release-management.yml

This file was deleted.

41 changes: 0 additions & 41 deletions .github/workflows/typedoc-ci.yml

This file was deleted.

1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20

0 comments on commit 2cbd6ee

Please sign in to comment.