Skip to content

Add publish workflow #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
99 changes: 99 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Publish

env:
PNPM_VERSION: 9.0.0

on:
push:
branches:
- main
# manual trigger for other branches
workflow_dispatch:

permissions:
id-token: write
contents: write
pull-requests: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
release:
name: Release
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20]

steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}

- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org/'

- name: Load cached dependencies
uses: actions/cache@v4.2.3
id: cache
with:
path: |
**/node_modules
**/.turbo
/home/runner/.cache/Cypress
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}

- name: Install Dependencies
run: pnpm i

- name: Setup npmrc
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc

- name: Create Release PR or publish stable version to npm
id: changesets
uses: changesets/action@v1
with:
createGithubReleases: false
publish: pnpm run pub:release --tag ${{ github.ref_name == 'next' && 'next' || 'latest' }}
version: pnpm run version
title: ${{ github.ref_name == 'main' && 'Publish a new stable version' || 'Publish a new pre-release version' }}
commit: >-
${{ github.ref_name == 'main' && 'chore(release): publish a new release version' || 'chore(release): publish a new pre-release version' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_PROVENANCE: true
NPM_CONFIG_ACCESS: public

- name: Send release notification
if: steps.changesets.outputs.published == 'true'
id: slack
uses: slackapi/slack-github-action@v1.27.0
with:
payload: |
{
"message": "[Tiptap CLI Release]: New Tiptap CLI version has been released to NPM."
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

- name: Send failure notification
if: failure()
id: slack_failure
uses: slackapi/slack-github-action@v1.27.0
with:
payload: |
{
"message": "[Tiptap CLI Release]: There was an issue publishing a new version. You can find the logs here: https://github.com/ueberdosis/tiptap-ui-components/actions/runs/${{ github.run_id }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@
"web:dev": "pnpm --filter=web dev",
"tiptap-cli": "pnpm --filter=tiptap-cli start:dev",
"pub:beta": "cd packages/cli && pnpm pub:beta",
"pub:release": "cd packages/cli && pnpm pub:release"
"pub:release": "cd packages/cli && pnpm pub:release",
"changeset": "changeset",
"version": "pnpm run changeset -- version && pnpm install --no-frozen-lockfile"
},
"devDependencies": {
"@changesets/cli": "^2.29.0",
"eslint": "^8.57.1",
"prettier": "^3.5.3",
"turbo": "^2.5.0"
},
"packageManager": "pnpm@9.0.0"
}
}
Loading