From f01d5c627d51d9499be5451bbe3efb2b5d0b08d3 Mon Sep 17 00:00:00 2001 From: akastercomcom Date: Wed, 6 Sep 2023 16:42:09 +0900 Subject: [PATCH 1/6] Create create_release.yml --- .github/workflows/create_release.yml | 39 ++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/create_release.yml diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml new file mode 100644 index 0000000..1e686f3 --- /dev/null +++ b/.github/workflows/create_release.yml @@ -0,0 +1,39 @@ +name: Create Release Branch +on: + workflow_dispatch: + inputs: + version: + type: choice + description: Sematic version type of new version + options: + - patch + - minor + - major +jobs: + release: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + ref: develop + - name: Git configuration + run: | + git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" + git config --global user.name "${GITHUB_ACTOR}" + - name: Upgrade version + run: | + yarn --no-git-tag-version version --$RELEASE_TYPE + echo "NEW_VERSION=$(npm pkg get version | tr -d '"')" >> $GITHUB_ENV + env: + RELEASE_TYPE: ${{ github.event.inputs.version }} + - name: Create release branch + run: | + git checkout -b release/${{ env.NEW_VERSION }} + git add "package.json" + git commit -m "Upgrade version to ${{ env.NEW_VERSION }}" + git push origin release/${{ env.NEW_VERSION }} + gh pr create -B main -H release/${{ env.NEW_VERSION }} -d --title 'Upgrade version to ${{ env.NEW_VERSION }}' --body 'Upgrade version to ${{ env.NEW_VERSION }}' + gh pr create -B develop -H release/${{ env.NEW_VERSION }} -d --title 'Release/${{ env.NEW_VERSION }} -> develop' --body 'Upgrade version to ${{ env.NEW_VERSION }}' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 7b26874c26e75ee1e1f04c2671fd5f43f3d61204 Mon Sep 17 00:00:00 2001 From: akastercomcom Date: Wed, 6 Sep 2023 16:44:02 +0900 Subject: [PATCH 2/6] Update create_release.yml --- .github/workflows/create_release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index 1e686f3..bb603ec 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -9,6 +9,7 @@ on: - patch - minor - major + - beta jobs: release: runs-on: ubuntu-latest From 2e6787b86c0cc3612bc60e9654e89925c4d07070 Mon Sep 17 00:00:00 2001 From: akastercomcom Date: Wed, 6 Sep 2023 16:58:53 +0900 Subject: [PATCH 3/6] Update create_release.yml --- .github/workflows/create_release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index bb603ec..1e686f3 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -9,7 +9,6 @@ on: - patch - minor - major - - beta jobs: release: runs-on: ubuntu-latest From c64453f91ff70faf433a29ac90b88213e0d7fb66 Mon Sep 17 00:00:00 2001 From: akastercomcom Date: Wed, 6 Sep 2023 17:07:22 +0900 Subject: [PATCH 4/6] Update create_release.yml --- .github/workflows/create_release.yml | 93 +++++++++++++++++----------- 1 file changed, 58 insertions(+), 35 deletions(-) diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index 1e686f3..3794be1 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -1,39 +1,62 @@ -name: Create Release Branch +# github action name +name: Auto Publish - patch update + +# develop 브랜치에 push 되면 자동 patch update를 한다는 구현 on: - workflow_dispatch: - inputs: - version: - type: choice - description: Sematic version type of new version - options: - - patch - - minor - - major + push: + branches: [ develop ] + +# 실제 실행 구현부 jobs: - release: + # build 환경 + build: runs-on: ubuntu-latest - + permissions: + contents: write + strategy: + matrix: + node-version: [16.13.1] + # 실행할 순서 steps: - - uses: actions/checkout@v3 - with: - ref: develop - - name: Git configuration - run: | - git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" - git config --global user.name "${GITHUB_ACTOR}" - - name: Upgrade version - run: | - yarn --no-git-tag-version version --$RELEASE_TYPE - echo "NEW_VERSION=$(npm pkg get version | tr -d '"')" >> $GITHUB_ENV - env: - RELEASE_TYPE: ${{ github.event.inputs.version }} - - name: Create release branch - run: | - git checkout -b release/${{ env.NEW_VERSION }} - git add "package.json" - git commit -m "Upgrade version to ${{ env.NEW_VERSION }}" - git push origin release/${{ env.NEW_VERSION }} - gh pr create -B main -H release/${{ env.NEW_VERSION }} -d --title 'Upgrade version to ${{ env.NEW_VERSION }}' --body 'Upgrade version to ${{ env.NEW_VERSION }}' - gh pr create -B develop -H release/${{ env.NEW_VERSION }} -d --title 'Release/${{ env.NEW_VERSION }} -> develop' --body 'Upgrade version to ${{ env.NEW_VERSION }}' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # github action에서 NodeJS 세팅을 위한 actions/setup-node@v2 action을 사용 + - uses: actions/checkout@v2 + - name: Set up NodeJS ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + registry-url: https://registry.npmjs.org/ + # yarn을 사용하기에 yarn을 global install하고 install dependencies + - name : Install Dependencies + run: | + npm install -g yarn + npm install --legacy-peer-deps --save-dev --ignore-scripts install-peers + yarn install + # npm version을 patch 명령어를 통해 올리고, 리눅스 파이프라인 명령어를 통해 patch로 변경한 버전을 저장 + - name : Patch + run: | + npm version patch > version.txt + # 저장한 버전 파일을 읽어 변수로 사용하기 위해 외부 action을 사용 -> setps.{id}.outputs.content로 사용 가능 + - name: Read version.txt + id: commit + uses: juliangruber/read-file-action@v1 + with: + path: ./version.txt + # version을 변경한 package.json을 commit, 바뀐 버전으로 commit message 작성 후 push + - name: Deploy and Push + run: | + git config --global user.name "${GITHUB_ACTOR}" + git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" + git add package.json + git commit -m "${{ (steps.commit.outputs.content) }}" + echo ${{ (steps.commit.outputs.content) }} + yarn deploy + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + # slack 웹훅을 통해 채널에 전송 + - name: Send result to slack + uses: Ilshidur/action-slack@2.0.2 + with: + args: "버전 ➡️${{ (steps.commit.outputs.content) }}의 결과는 ➡️${{ job.status }} 에요" + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} + if: always() From b884ddc1125527f0ab5ac733c59b06620319bfc5 Mon Sep 17 00:00:00 2001 From: Yoojin Ko Date: Tue, 26 Sep 2023 15:20:07 +0900 Subject: [PATCH 5/6] fix: docs pipeline --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 707674a..b85caaf 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,7 +1,7 @@ name: Docs on: push: - branches: [main, develop] + branches: [main] jobs: build: runs-on: ubuntu-latest From 298417dd61f426c86eb2dd14dc20b4767c5cb4f0 Mon Sep 17 00:00:00 2001 From: Yoojin Ko Date: Tue, 26 Sep 2023 15:21:08 +0900 Subject: [PATCH 6/6] chore: update package ver --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 418f92c..6ae2f5b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ainize-team/ainize-sdk", - "version": "0.0.1", + "version": "1.0.0", "main": "dist/ainize.js", "types": "dist/ainize.d.ts", "scripts": {