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
91 changes: 74 additions & 17 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,50 @@ on:
push:
branches:
- main
issue_comment:
types:
- created

concurrency: ${{ github.workflow }}-${{ github.ref }}

permissions:
contents: write # to create release
id-token: write
contents: write

jobs:
get-branch:
if: github.event_name == 'issue_comment' && github.event.issue.pull_request && (github.event.comment.body == 'canary-publish' || github.event.comment.body == '/canary-publish' || github.event.comment.body == 'rc-publish' || github.event.comment.body == '/rc-publish')
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.get_branch.outputs.branch }}
steps:
- name: Get PR branch name
id: get_branch
run: |
PR=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" ${{ github.event.issue.pull_request.url }})
branch=$(echo "$PR" | jq -r '.head.ref')
echo "branch=$branch" >> "$GITHUB_OUTPUT"

release:
runs-on: ubuntu-latest
needs: [get-branch]
if: |
always() &&
(github.event_name == 'push' ||
(github.event_name == 'issue_comment' && needs.get-branch.result == 'success'))
outputs:
published: ${{ steps.changesets.outputs.published }}
commithelperGoWillBePublished: ${{ steps.checkCommitHelperGo.outputs.commithelperGoWillBePublished }}
packageVersion: ${{ steps.getPackageVersion.outputs.packageVersion }}
packageVersion: ${{ steps.getCommitHelperGoVersion.outputs.packageVersion }}
env:
SKIP_COMMIT_HELPER_POSTINSTALL: 1
GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: checkoutRepo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ needs.get-branch.outputs.branch || github.ref }}
token: ${{ secrets.ACTION_TOKEN }}
fetch-depth: 0

Expand All @@ -33,16 +56,21 @@ jobs:
with:
go-version: '1.24'

- uses: pnpm/action-setup@v4

- name: useNodeJs
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'pnpm'

- name: installCorepack
run: npm install -g corepack@0.31.0

- name: enableCorepack
run: corepack enable
- name: Check and upgrade npm
run: |
echo "Current npm version:"
npm --version
npm install -g npm@latest
echo "Upgraded npm version:"
npm --version

- name: installDependencies
run: pnpm install --frozen-lockfile
Expand All @@ -64,25 +92,54 @@ jobs:
echo "commithelperGoWillBePublished=true" >> $GITHUB_OUTPUT
fi

- name: getPackageVersion
id: getPackageVersion
- name: getCommitHelperGoVersion
id: getCommitHelperGoVersion
run: |
packageVersion=$(cat packages/commithelper-go/package.json | jq -r '.version')
echo "packageVersion=$packageVersion" >> $GITHUB_OUTPUT

- name: buildNodePackages
run: pnpm build

- name: createReleasePullRequestOrPublishToNpm
id: changesets
uses: changesets/action@v1
- name: Publish - Release
if: github.event_name == 'push'
uses: NaverPayDev/changeset-actions/publish@main
with:
title: '🚀 version changed packages'
commit: '📦 bump changed packages version'
publish: pnpm release
github_token: ${{ secrets.ACTION_TOKEN }}
git_username: npayfebot
git_email: npay.fe.bot@navercorp.com
publish_script: pnpm release
pr_title: '🚀 version changed packages'
commit_message: '📦 bump changed packages version'
create_github_release_tag: true
formatting_script: pnpm run markdownlint:fix
env:
GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish - Canary
if: github.event_name == 'issue_comment' && (github.event.comment.body == 'canary-publish' || github.event.comment.body == '/canary-publish')
uses: NaverPayDev/changeset-actions/canary-publish@main
with:
github_token: ${{ secrets.ACTION_TOKEN }}
npm_tag: canary
publish_script: pnpm run release:canary
packages_dir: 'packages'
excludes: '.turbo,.github'
version_template: '{VERSION}-canary.{DATE}-{COMMITID7}'

- name: Publish - RC
if: github.event_name == 'issue_comment' && (github.event.comment.body == 'rc-publish' || github.event.comment.body == '/rc-publish')
uses: NaverPayDev/changeset-actions/canary-publish@main
with:
github_token: ${{ secrets.ACTION_TOKEN }}
npm_tag: rc
publish_script: pnpm run release:canary
packages_dir: 'packages'
excludes: '.turbo,.github'
version_template: '{VERSION}-rc.{DATE}-{COMMITID7}'
create_release: true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

upload-assets:
needs: release
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
"type": "git",
"url": "https://github.com/NaverPayDev/cli.git"
},
"bugs": {
"url": "https://github.com/NaverPayDev/cli/issues"
},
"version": "0.0.0",
"homepage": "https://github.com/NaverPayDev/cli",
"scripts": {
"prepare": "husky install",
"start": "turbo run start",
Expand All @@ -18,7 +22,7 @@
"markdownlint": "markdownlint '**/*.md' '#.changeset' '#**/CHANGELOG.md'",
"markdownlint:fix": "markdownlint --fix '**/*.md' '#.changeset' '#**/CHANGELOG.md'",
"clean": "turbo run clean && rm -rf ./node_modules && pnpm i",
"release:canary": "pnpm run build && changeset publish --no-git-tag",
"release:canary": "changeset publish --no-git-tag",
"release": "pnpm run build && changeset publish"
},
"lint-staged": {
Expand Down
1 change: 1 addition & 0 deletions packages/commit-helper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.2.1",
"description": "help your commit in git",
"main": "./dist/index.js",
"homepage": "https://github.com/NaverPayDev/cli/tree/main/packages/commit-helper",
"bin": {
"commit-helper": "./dist/index.js"
},
Expand Down
1 change: 1 addition & 0 deletions packages/commithelper-go/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"bin": {
"commithelper-go": "bin/cli.js"
},
"homepage": "https://github.com/NaverPayDev/cli/tree/main/packages/commithelper-go",
"scripts": {
"build:windows": "GOOS=windows GOARCH=amd64 go build -o dist/commithelper-go-windows-amd64.exe main.go",
"build:macos:amd64": "GOOS=darwin GOARCH=amd64 go build -o dist/commithelper-go-darwin-amd64 main.go",
Expand Down
1 change: 1 addition & 0 deletions packages/fmb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"scripts": {
"start": "node index.js"
},
"homepage": "https://github.com/NaverPayDev/cli/tree/main/packages/fmb",
"keywords": [
"git",
"cli",
Expand Down
1 change: 1 addition & 0 deletions packages/publint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "dist/src/index.js",
"keywords": [],
"author": "yceffort <yceffort@gmail.com>",
"homepage": "https://github.com/NaverPayDev/cli/tree/main/packages/publint",
"type": "module",
"license": "ISC",
"sideEffects": false,
Expand Down