Skip to content
Merged
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
39 changes: 19 additions & 20 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
(github.event_name == 'push' ||
(github.event_name == 'issue_comment' && needs.get-branch.result == 'success'))
outputs:
published: ${{ steps.changesets.outputs.published }}
published: ${{ steps.publish_release.outputs.published || steps.publish_canary.outputs.published || steps.publish_rc.outputs.published }}
commithelperGoWillBePublished: ${{ steps.checkCommitHelperGo.outputs.commithelperGoWillBePublished }}
packageVersion: ${{ steps.getCommitHelperGoVersion.outputs.packageVersion }}
env:
Expand Down Expand Up @@ -75,23 +75,6 @@ jobs:
- name: installDependencies
run: pnpm install --frozen-lockfile

- name: checkIfCommitHelperGoWasPublished
id: checkCommitHelperGo
run: |
packageVersion=$(cat packages/commithelper-go/package.json | jq -r '.version')
npmInfo=$(npm info @naverpay/commithelper-go@$packageVersion --json >/dev/null 2>&1 && npm info @naverpay/commithelper-go@$packageVersion --json 2>/dev/null || echo "{}")
isValidJson=$(echo "$npmInfo" | jq empty > /dev/null 2>&1 && echo "true" || echo "false")
if [ "$isValidJson" = "true" ]; then
isPublished=$(echo "$npmInfo" | jq -r 'if .error then "false" else "true" end')
else
isPublished="false"
fi
if [ "$isPublished" = "false" ]; then
echo "commithelperGoWillBePublished=true" >> $GITHUB_OUTPUT
else
echo "commithelperGoWillBePublished=false" >> $GITHUB_OUTPUT
fi

- name: getCommitHelperGoVersion
id: getCommitHelperGoVersion
run: |
Expand All @@ -102,6 +85,7 @@ jobs:
run: pnpm build

- name: Publish - Release
id: publish_release
if: github.event_name == 'push'
uses: NaverPayDev/changeset-actions/publish@main
with:
Expand All @@ -117,6 +101,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }}

- name: Publish - Canary
id: 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:
Expand All @@ -126,9 +111,10 @@ jobs:
packages_dir: 'packages'
excludes: '.turbo,.github'
version_template: '{VERSION}-canary.{DATE}-{COMMITID7}'
create_release: ${{ steps.checkCommitHelperGo.outputs.commithelperGoWillBePublished == 'true' }}
create_release: true

- name: Publish - RC
id: 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:
Expand All @@ -142,9 +128,22 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check if commithelper-go was published
id: checkCommitHelperGo
if: always()
run: |
publishedPackages='${{ steps.publish_release.outputs.publishedPackages || steps.publish_canary.outputs.publishedPackages || steps.publish_rc.outputs.publishedPackages }}'
if [ -z "$publishedPackages" ] || [ "$publishedPackages" == "null" ]; then
echo "commithelperGoWillBePublished=false" >> $GITHUB_OUTPUT
elif echo "$publishedPackages" | jq -e '.[] | select(.name == "@naverpay/commithelper-go")' > /dev/null 2>&1; then
echo "commithelperGoWillBePublished=true" >> $GITHUB_OUTPUT
else
echo "commithelperGoWillBePublished=false" >> $GITHUB_OUTPUT
fi

upload-assets:
needs: release
if: needs.release.outputs.commithelperGoWillBePublished == 'true'
if: needs.release.outputs.published == 'true' && needs.release.outputs.commithelperGoWillBePublished == 'true'
uses: ./.github/workflows/release-asset.yaml
with:
package: '@naverpay/commithelper-go'
Expand Down
Loading