diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml index e15ad2d6c..0f6245829 100644 --- a/.github/workflows/publish-package.yml +++ b/.github/workflows/publish-package.yml @@ -18,8 +18,11 @@ jobs: - uses: actions/setup-node@v4 - name: 'validation' uses: actions/github-script@v7 + env: + VERSION: ${{ github.event.inputs.version }} with: script: | + const version = process.env.VERSION; const permission = await github.rest.repos.getCollaboratorPermissionLevel({ owner: context.repo.owner, repo: context.repo.repo, @@ -29,8 +32,8 @@ jobs: core.setFailed(`User ${context.actor} does not have write or admin permissions to this repository.`); } const currentBranch = context.ref.replace('refs/heads/', ''); - if (currentBranch !== `release/${{ github.event.inputs.version }}`) { - core.setFailed(`Current branch ${currentBranch} does not match release/${{ github.event.inputs.version }}`); + if (currentBranch !== `release/${version}`) { + core.setFailed(`Branch ${currentBranch} ≠ release/${version}`); } const pullRequests = await github.rest.pulls.list({ owner: context.repo.owner, @@ -50,14 +53,16 @@ jobs: echo "//registry.npmjs.org/:_authToken=${{ secrets.npm_token }}" >> .npmrc git config --global user.email "sha.sdk_deployment@sendbird.com" git config --global user.name "sendbird-sdk-deployment" - - name: 'publish to npm' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - yarn lerna version ${{ github.event.inputs.version }} --yes - yarn lerna publish from-git --yes +# - name: 'publish to npm' +# env: +# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# VERSION: ${{ github.event.inputs.version }} +# run: | +# yarn lerna version "$VERSION" --yes +# yarn lerna publish from-git --yes - name: 'approve a pull request' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ env.PR_NUMBER }} run: | - gh pr review ${{ env.PR_NUMBER }} --approve --body "approved by automation" + gh pr review "$PR_NUMBER" --approve --body "approved by automation"