[Common] 패키지 배포 ci 환경 설정 #16
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
name: "Publish Github Workspace" | |
on: | |
pull_request: | |
branches: | |
- publish | |
types: closed | |
permissions: | |
contents: write # for checkout and tag | |
pull-requests: write # for comments | |
packages: write # for publish | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
clean: true | |
fetch-depth: 0 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Install dependencies | |
run: pnpm install | |
- name: Publish to Github Registry | |
run: pnpm run publish from-git --yes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
merge: | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Merge publish to main | |
run: | | |
git config user.name "${{ github.actor }}" | |
git config user.email "${{ github.actor }}@users.noreply.github.com" | |
git checkout main | |
git merge --no-ff --no-edit publish | |
git push origin main |