미사용 패키지 제거, 빌드 명령어 최신화, 버전 추가 #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages | |
name: package publish action | |
on: | |
pull_request: | |
types: closed | |
jobs: | |
check-pr-merged: | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: set git user | |
run: | | |
git config user.name "${{ github.actor }}" | |
git config user.email "${{ github.actor }}@users.noreply.github.com" | |
- name: setup git authentication | |
run: | | |
git remote set-url origin https://github.com/${{ github.repository }}.git | |
- name: install dependencies | |
run: npm install | |
- name: build tsc with clean | |
run: npm run build | |
- name: Commit build artifacts | |
run: | | |
git add dist | |
git commit -m "Build artifacts" || true | |
- name: version patch | |
run: npm version patch | |
- name: Push changes | |
run: git push origin HEAD:${{ github.ref }} && git push origin --tags | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check & Publish utils package | |
uses: JS-DevTools/npm-publish@v1 | |
id: utils | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
package: "./package.json" | |
- name: Check pr merged | |
id: check_pr_merged | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const pullRequestLink = context.payload.pull_request.html_url ?? context.payload.pull_request._links.html.href; | |
const pullRequestTitle = context.payload.pull_request.title; | |
const repositoryName = context.payload.pull_request.base.repo.name; | |
core.setOutput('pullRequestLink', JSON.stringify(pullRequestLink)); | |
core.setOutput('pullRequestTitle', JSON.stringify(pullRequestTitle)); | |
core.setOutput('repositoryName', JSON.stringify(repositoryName)); | |
- name: Send Slack Trigger | |
run: | | |
curl -X POST https://api-slack.internal.bcsdlab.com/api/update-package/frontend \ | |
-H 'Content-Type: application/json' \ | |
-d '{ | |
"pullRequestLink": ${{ steps.check_pr_merged.outputs.pullRequestLink }}, | |
"pullRequestTitle": ${{steps.check_pr_merged.outputs.pullRequestTitle }}, | |
"repositoryName": ${{steps.check_pr_merged.outputs.repositoryName }}, | |
"version": ${{ steps.utils.outputs.version }} | |
}' |