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
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
run: twingate status

- run: pnpm install --frozen-lockfile --strict-peer-dependencies
- run: pnpm run build --noEmit
- run: pnpm run build
- run: pnpm run lint

- run: pnpm run test
Expand Down
108 changes: 93 additions & 15 deletions .github/workflows/pnpm-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,16 @@ on:
- v*

jobs:
publish:
runs-on: ubuntu-latest

build:
permissions:
contents: write # Upload the release files
id-token: write # Add `--provenance`
packages: write # Publish the package
contents: read

if: github.actor != 'nektos/act'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: pnpm/action-setup@v6
with:
version: latest
Expand All @@ -27,25 +25,105 @@ jobs:
node-version: latest
- run: pnpm install
- run: pnpm build
- run: pnpm pack --pack-gzip-level 9

- if: github.actor != 'nektos/act'
uses: actions/upload-artifact@v7
with:
name: coderabbitai-bitbucket-${{ github.ref_name }}.tgz
path: coderabbitai-bitbucket-*.tgz
compression-level: 9
if-no-files-found: error

publish-npm:
permissions:
id-token: write # Add `--provenance`

needs: build
if: github.actor != 'nektos/act'
runs-on: ubuntu-latest

environment:
name: npm-public-registry
url: ${{ steps.url.outputs.url }}

steps:
- uses: pnpm/action-setup@v6
with:
version: latest
- uses: actions/setup-node@v6
with:
registry-url: https://npm.pkg.github.com
registry-url: https://registry.npmjs.org
scope: "@coderabbitai"
- run: pnpm publish --access public --no-git-checks --provenance

- uses: actions/download-artifact@v8
with:
name: coderabbitai-bitbucket-${{ github.ref_name }}.tgz

- run: pnpm publish coderabbitai-bitbucket-*.tgz --access public --no-git-checks --provenance
Comment thread
coderabbitai[bot] marked this conversation as resolved.

- id: url
run: echo "url=https://www.npmjs.com/package/@coderabbitai/bitbucket/v/${VERSION#v}" >> "$GITHUB_OUTPUT"
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ github.ref_name }}

publish-github:
permissions:
id-token: write # Add `--provenance`
packages: write # Publish the package

needs: build
if: github.actor != 'nektos/act'
runs-on: ubuntu-latest

environment:
name: github-packages-registry
url: ${{ steps.url.outputs.url }}

steps:
- uses: pnpm/action-setup@v6
with:
version: latest
- uses: actions/setup-node@v6
with:
registry-url: https://registry.npmjs.org
registry-url: https://npm.pkg.github.com
scope: "@coderabbitai"
- run: pnpm publish --access public --no-git-checks --provenance

- uses: actions/download-artifact@v8
with:
name: coderabbitai-bitbucket-${{ github.ref_name }}.tgz

- run: pnpm publish coderabbitai-bitbucket-*.tgz --access public --no-git-checks --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.CODERABBIT_NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- run: pnpm pack --pack-gzip-level 9
- run: gh release create "$VERSION" --generate-notes --title "$VERSION" --verify-tag coderabbitai-bitbucket-*.tgz
- id: url
run: |
url=$(gh api '/users/coderabbitai/packages/npm/bitbucket/versions' | jq -r --arg NAME "${VERSION#v}" '.[] | select(.name == $NAME) | .html_url')
echo "url=$url" >> "$GITHUB_OUTPUT"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ github.ref_name }}

release:
permissions:
contents: write # Upload the release files

needs: build
if: github.actor != 'nektos/act'
runs-on: ubuntu-latest

environment:
name: github-releases
url: ${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ github.ref_name }}

steps:
- uses: actions/download-artifact@v8
with:
name: coderabbitai-bitbucket-${{ github.ref_name }}.tgz

- run: gh release create "$VERSION" --generate-notes --repo "$REPO" --title "$VERSION" --verify-tag coderabbitai-bitbucket-*.tgz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
VERSION: ${{ github.ref_name }}
30 changes: 30 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Contributing

## Publishing

This project offers a GitHub Workflow to automatically publish a version to NPM, to GitHub Packages and to GitHub Releases on the push of a tag.

Start by updating the version number:

```sh
git checkout main
git pull --autostash --prune --rebase

VERSION=$(pnpm version patch --no-git-tag-version)
pnpm run format

git checkout -b "release/$VERSION"
git commit --all --message "🔖 $VERSION"
git push --set-upstream origin "release/$VERSION"

gh pr create --assignee @me --base main --draft --fill-verbose --head "release/$VERSION" --title "🔖 $VERSION"
```

Once the CI passes, merge the pull request, wait for the CI to pass again then push a new tag:

```sh
git checkout main
git pull --autostash --prune --rebase
git tag "$VERSION" --annotate --message "🔖 $VERSION" --sign
git push --tags
```
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"repository": "github:coderabbitai/bitbucket",
"scripts": {
"build": "tsgo",
"build": "tsgo --build",
"clean": "rm -rf dist docs node_modules tsconfig.tsbuildinfo",
"dev": "node ./src/main.ts",
"docs": "typedoc",
Expand All @@ -50,26 +50,26 @@
"postopenapi-typescript:server": "ts-autofix ./src/server/openapi && pnpm run lint:fix"
},
"dependencies": {
"openapi-fetch": "~0.15.0"
"openapi-fetch": "~0.17.0"
},
"devDependencies": {
"@eslint/js": "^9.21.0",
"@eslint/js": "^10.0.1",
"@natoboram/load_env": "^2.0.0",
"@types/node": "^25.0.3",
"@typescript/native-preview": "7.0.0-dev.20260201.1",
"dotenv": "^17.0.1",
"eslint": "^9.21.0",
"eslint-config-prettier": "^10.0.2",
"globals": "^17.0.0",
"jiti": "^2.4.2",
"@types/node": "^25.9.3",
"@typescript/native-preview": "7.0.0-dev.20260614.1",
"dotenv": "^17.4.2",
"eslint": "^10.5.0",
"eslint-config-prettier": "^10.1.8",
"globals": "^17.6.0",
"jiti": "^2.7.0",
"markdownlint-cli2": "^0.22.1",
"openapi-typescript": "^7.8.0",
"prettier": "^3.5.2",
"openapi-typescript": "^7.13.0",
"prettier": "^3.8.4",
"ts-autofix": "^1.0.0",
"typedoc": "^0.28.1",
"typescript": "5.9.3",
"typescript-eslint": "^8.25.0",
"vitest": "^4.0.18"
"typedoc": "^0.28.19",
"typescript": "6.0.3",
"typescript-eslint": "^8.61.0",
"vitest": "^4.1.8"
},
"type": "module",
"exports": {
Expand Down
Loading