Skip to content

Commit

Permalink
fix(ci): update release & publish script
Browse files Browse the repository at this point in the history
  • Loading branch information
sawaYch committed Apr 5, 2024
1 parent b42390d commit 55afd67
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 78 deletions.
56 changes: 0 additions & 56 deletions .github/workflows/publish-source-code.yml

This file was deleted.

38 changes: 18 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
name: Release
# trigger only when packages code modified are merged on main branch
name: Bump version & publish to NPM

on:
push:
branches: [master]
# paths:
# - 'packages/next-youtube-livechat/**'
branches:
- main
paths:
- 'packages/next-youtube-livechat/**'
workflow_dispatch: {}

jobs:
release:
name: Release
if: ${{ github.repository_owner == 'sawaYch' }}
runs-on: ubuntu-latest
# permissions:
# contents: write
# deployments: write
# packages: write
# pull-requests: write
permissions:
contents: write # to create release (changesets/action)
issues: write # to post issue comments (changesets/action)
pull-requests: write # to create pull request (changesets/action)
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Setup Node.js 20
uses: actions/setup-node@v4
Expand All @@ -31,12 +30,6 @@ jobs:
- name: Restore dependencies
run: npx ci

- name: Install semantic-release extra plugins
run: npm install --save-dev @semantic-release/changelog @semantic-release/git

- name: Restore project deps
run: npm ci

- name: Build the package next-youtube-livechat
run: cd packages/next-youtube-livechat && npm run build

Expand All @@ -49,8 +42,13 @@ jobs:
- name: Typescript check
run: npm run typecheck

- name: Release
- name: Create Release Pull Request or Publish to npm
uses: changesets/action@v1
with:
publish: npm run release
version: npm run version
commit: 'chore: new release'
title: 'chore: new release candidate'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
run: npx semantic-release
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
"lint": "turbo run lint",
"format": "turbo run format",
"format:fix": "turbo run format:fix",
"typecheck": "turbo run typecheck"
"typecheck": "turbo run typecheck",
"version": "turbo run version",
"release": "turbo run release"
},
"devDependencies": {
"@changesets/changelog-github": "^0.5.0",
Expand Down
4 changes: 3 additions & 1 deletion packages/next-youtube-livechat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
"lint": "eslint --ext .ts,.tsx",
"format": "npx prettier -c \"**/*.{ts,tsx,css}\"",
"format:fix": "npx prettier -w \"**/*.{ts,tsx,css}\"",
"typecheck": "tsc --noEmit"
"typecheck": "tsc --noEmit",
"version": "npx changeset version",
"release": "npx changeset publish"
},
"dependencies": {
"next": "^14.1.1",
Expand Down

0 comments on commit 55afd67

Please sign in to comment.