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 e89aa0c
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 78 deletions.
56 changes: 0 additions & 56 deletions .github/workflows/publish-source-code.yml

This file was deleted.

45 changes: 24 additions & 21 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,26 +30,30 @@ 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
run: npm run build
working-directory: packages/next-youtube-livechat

- name: Lint check
run: npm run lint
working-directory: packages/next-youtube-livechat

- name: Code format check
run: npm run format
working-directory: packages/next-youtube-livechat

- name: Typescript check
run: npm run typecheck
working-directory: packages/next-youtube-livechat

- 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'
createGithubReleases: true
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": "npx changeset version",
"release": "npx changeset publish"
},
"devDependencies": {
"@changesets/changelog-github": "^0.5.0",
Expand Down
6 changes: 6 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
},
"dev": {
"cache": false
},
"release": {
"cache": false
},
"version": {
"cache": false
}
}
}

0 comments on commit e89aa0c

Please sign in to comment.