This repository was archived by the owner on Feb 10, 2026. It is now read-only.
Deploy Package #13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy Package | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version_type: | |
| description: "Version bump type" | |
| required: true | |
| default: "patch" | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| - none | |
| deploy_target: | |
| description: "Deploy target" | |
| required: true | |
| default: "both" | |
| type: choice | |
| options: | |
| - both | |
| - npm | |
| - github | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| env: | |
| NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| NODE_AUTH_TOKEN: ${{ secrets.GH_TOKEN }} | |
| BUN_AUTH_TOKEN: ${{ secrets.GH_TOKEN }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version-file: "package.json" | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Build package | |
| run: bun run build | |
| - name: Lint code | |
| run: bun run lint | |
| - name: Bump version | |
| if: github.event.inputs.version_type != 'none' | |
| run: bun bump ${{ github.event.inputs.version_type }} | |
| - name: Get package version | |
| id: package-version | |
| run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT | |
| - name: Generate documentation | |
| run: bun run docs | |
| - name: Publish to NPM Packages | |
| if: github.event.inputs.deploy_target == 'npm' || github.event.inputs.deploy_target == 'both' | |
| run: | | |
| echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc | |
| bun publish --registry https://registry.npmjs.org | |
| - name: Publish to GitHub Packages | |
| if: github.event.inputs.deploy_target == 'github' || github.event.inputs.deploy_target == 'both' | |
| run: | | |
| bun pm pkg set name=@cmru-computer-science-66/cmru-api | |
| echo "//npm.pkg.github.com/:_authToken=${{ secrets.GH_TOKEN }}" > ~/.npmrc | |
| echo "@cmru-computer-science-66:registry=https://npm.pkg.github.com" >> ~/.npmrc | |
| npm publish --registry https://npm.pkg.github.com | |
| bun pm pkg set name=@cmru-comsci-66/cmru-api | |
| - name: Automatically Commit Changes | |
| uses: stefanzweifel/git-auto-commit-action@v7 | |
| with: | |
| push_options: "--force" | |
| commit_options: "--no-verify" | |
| tagging_message: "v${{ steps.package-version.outputs.version }}" | |
| commit_message: "Release v${{ steps.package-version.outputs.version }}" | |
| skip_checkout: true |