-
Notifications
You must be signed in to change notification settings - Fork 142
[CLNP-8355] [ci]: add automated release workflow and update CI to Node 24 #1414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 19 commits
06a3a62
dc367f4
bc43850
eeae3ce
79eb576
0fd80e7
123b89a
cd7aa3f
7edf6bb
dd163ea
23c388e
f6bfeb4
13b9bf8
641124c
c860537
21ee9f4
7ee3365
bfdf72b
dbf4b11
1c5a2b7
0641a48
90de97a
8734311
25cd4d9
b752694
e3ad381
4859cfb
f42aa34
a1299d3
5c54bd4
7658017
63f0480
9525cdd
8c3d75f
6b93459
a4b9d66
852cb3e
52f39e2
4c50a76
01abdad
90ca78b
ecce64d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,18 @@ | ||
| name: Coverage Report | ||
|
|
||
| # Manual trigger only. To restore PR comment trigger, replace workflow_dispatch with: | ||
| # on: | ||
| # issue_comment: | ||
| # types: [created, edited] | ||
| # And add this condition to the job: | ||
| # if: github.event.issue.pull_request && contains(github.event.comment.body, './coverage') | ||
|
|
||
| on: | ||
| issue_comment: | ||
| types: [created, edited] | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| coverage: | ||
| runs-on: ubuntu-latest | ||
| if: github.event.issue.pull_request && contains(github.event.comment.body, './coverage') | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: ArtiomTr/jest-coverage-report-action@v2 | ||
| coverage: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: ArtiomTr/jest-coverage-report-action@v2 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,156 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| release_ticket_key: | ||
| description: 'Release Ticket Key (e.g., UIKIT-1234)' | ||
| required: true | ||
| type: string | ||
|
|
||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| id-token: write | ||
| contents: write | ||
|
|
||
| env: | ||
| BOT_GH_TOKEN: ${{ secrets.SDK_GH_BOT1_TOKEN }} | ||
| JIRA_AUTH_USER: ${{ secrets.JIRA_AUTH_USER }} | ||
| JIRA_AUTH_API_TOKEN: ${{ secrets.JIRA_AUTH_API_TOKEN }} | ||
| SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | ||
| RELEASE_VERSION: '' # Set by "Extract release version" step | ||
| RELEASE_TICKET_KEY: ${{ inputs.release_ticket_key }} | ||
| SLACK_RELEASE_CHANNEL_ID: ${{ vars.SLACK_RELEASE_CHANNEL_ID }} | ||
| BRANCH_NAME: ${{ github.ref_name }} | ||
| REPO_NAME: ${{ github.event.repository.name }} | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| token: ${{ env.BOT_GH_TOKEN }} | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: '24' | ||
| cache: 'yarn' | ||
|
|
||
| - name: Install dependencies and build | ||
| run: | | ||
| yarn install --immutable | ||
| yarn build | ||
|
|
||
| - name: Extract release version | ||
| run: | | ||
| pip3 install requests | ||
| git config --global user.email "sha.sdk_deployment@sendbird.com" | ||
| git config --global user.name "sendbird-sdk-deployment" | ||
| git clone --depth 1 --branch main https://${{ env.BOT_GH_TOKEN }}@github.com/sendbird/sdk-deployment.git ~/sdk-deployment | ||
| release_version=$(python3 ~/sdk-deployment/scripts/v1.2/extract_version.py --branch_name "$BRANCH_NAME") | ||
| echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV | ||
|
|
||
| - name: Merge release branch to main | ||
| run: | | ||
| python3 ~/sdk-deployment/scripts/v1.2/github_pr_merge.py \ | ||
| --github_api_token "$BOT_GH_TOKEN" \ | ||
| --repo_name "$REPO_NAME" \ | ||
| --branch_name "$BRANCH_NAME" | ||
| git fetch origin main | ||
| git switch main | ||
| git pull origin main | ||
|
|
||
| - name: Rebuild after merge | ||
| run: | | ||
| yarn install --immutable | ||
| yarn build | ||
|
|
||
| - name: Publish to npm | ||
| run: | | ||
| cd ./dist | ||
| npm publish --access=public --provenance | ||
|
sf-tyler-jeong marked this conversation as resolved.
Comment on lines
+100
to
+112
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The workflow builds Useful? React with 👍 / 👎.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. merge 후 |
||
|
|
||
| - name: Verify npm package publication | ||
| run: | | ||
| cd ./dist | ||
| PACKAGE_NAME=$(node -p "require('./package.json').name") | ||
| PACKAGE_VERSION=$(node -p "require('./package.json').version") | ||
| max_attempts=6 | ||
| attempt=1 | ||
| while [ $attempt -le $max_attempts ]; do | ||
| if npm view --registry=https://registry.npmjs.org/ "$PACKAGE_NAME@$PACKAGE_VERSION" version > /dev/null 2>&1; then | ||
| echo "Package $PACKAGE_NAME@$PACKAGE_VERSION successfully published to npm" | ||
| exit 0 | ||
| fi | ||
| echo "Attempt $attempt/$max_attempts: Package not visible yet. Waiting 20s..." | ||
| sleep 20 | ||
| attempt=$((attempt + 1)) | ||
| done | ||
| echo "Package $PACKAGE_NAME@$PACKAGE_VERSION not found on npm registry after $max_attempts attempts" | ||
| exit 1 | ||
|
|
||
| - name: Create git tag | ||
| run: | | ||
| git tag "v${{ env.RELEASE_VERSION }}" | ||
| git push origin "v${{ env.RELEASE_VERSION }}" | ||
|
|
||
| - name: Create GitHub Release | ||
| run: | | ||
| python3 ~/sdk-deployment/scripts/v1.2/create_github_release.py \ | ||
| --github_api_token "$BOT_GH_TOKEN" \ | ||
| --repo_name "$REPO_NAME" \ | ||
| --tag_name "v${{ env.RELEASE_VERSION }}" \ | ||
| --target_commitish main \ | ||
| --body_path "$GITHUB_WORKSPACE/CHANGELOG_DRAFT.md" | ||
|
|
||
| - name: Slack notification | ||
| if: ${{ success() }} | ||
| continue-on-error: true | ||
| uses: slackapi/slack-github-action@v1.24.0 | ||
| env: | ||
| SLACK_BOT_TOKEN: ${{ env.SLACK_BOT_TOKEN }} | ||
| with: | ||
| channel-id: ${{ env.SLACK_RELEASE_CHANNEL_ID }} | ||
| payload: | | ||
| { | ||
| "blocks": [ | ||
| { | ||
| "type": "section", | ||
| "text": { | ||
| "type": "mrkdwn", | ||
| "text": ":tada: <https://github.com/${{ github.repository }}/releases/tag/v${{ env.RELEASE_VERSION }}|@sendbird/uikit-react ${{ env.RELEASE_VERSION }}> has been released!" | ||
| } | ||
| } | ||
| ] | ||
| } | ||
|
|
||
| - name: Jira - Transition to RELEASED | ||
| if: ${{ success() }} | ||
| run: | | ||
| python3 ~/sdk-deployment/scripts/v1.2/transit_ticket.py \ | ||
| --jira_auth_user "$JIRA_AUTH_USER" \ | ||
| --jira_auth_api_token "$JIRA_AUTH_API_TOKEN" \ | ||
| --issue_key "$RELEASE_TICKET_KEY" \ | ||
| --from_issue_state RELEASING \ | ||
| --to_issue_state RELEASED | ||
|
|
||
| - name: Jira - Rollback on failure | ||
| if: ${{ failure() }} | ||
| run: | | ||
| if ! python3 -c "import requests" 2>/dev/null; then | ||
| echo "Installing requests (not yet available)..." | ||
| pip3 install requests | ||
| fi | ||
| if [ ! -d ~/sdk-deployment ]; then | ||
| echo "Cloning sdk-deployment (not yet available)..." | ||
| git clone --depth 1 --branch main https://${{ env.BOT_GH_TOKEN }}@github.com/sendbird/sdk-deployment.git ~/sdk-deployment | ||
| fi | ||
| python3 ~/sdk-deployment/scripts/v1.2/transit_ticket.py \ | ||
| --jira_auth_user "$JIRA_AUTH_USER" \ | ||
| --jira_auth_api_token "$JIRA_AUTH_API_TOKEN" \ | ||
| --issue_key "$RELEASE_TICKET_KEY" \ | ||
| --from_issue_state RELEASING \ | ||
| --to_issue_state CONDITIONAL_RELEASE_APPROVED | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| ### Features | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. github에서 release tag 생성에 필요해서 추가 하신거 같은데, 최종 chagelog.md로 update는 언제 하게 되나요?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. prepare-changelog 워크플로우를 추가해서 자동화했습니다. release 브랜치 push 시 CHANGELOG_DRAFT.md 내용이 CHANGELOG.md에 자동으로 prepend되고, 실제 릴리즈 시점에 release-workflow가 날짜를 확정합니다. 개발자는 CHANGELOG_DRAFT.md만 작성하면 됩니다. |
||
| - Added ... | ||
|
|
||
| ### Fixes | ||
| - Fixed a bug where ... | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,9 +28,9 @@ module.exports = { | |
|
|
||
| // An array of regexp pattern strings used to skip coverage collection | ||
| coveragePathIgnorePatterns: [ | ||
| "/node_modules/", | ||
| "/_externals/", | ||
| "/stories/" | ||
| '/node_modules/', | ||
| '/_externals/', | ||
| '/stories/', | ||
| ], | ||
|
|
||
| // A list of reporter names that Jest uses when writing coverage reports | ||
|
|
@@ -82,8 +82,8 @@ module.exports = { | |
|
|
||
| // A map from regular expressions to module names that allow to stub out resources with a single module | ||
| moduleNameMapper: { | ||
| "\\.(css|less|sass|scss)$": "<rootDir>/__mocks__/styleMock.js", | ||
| "\\.(gif|ttf|eot|svg)$": "<rootDir>/__mocks__/fileMock.js" | ||
| '\\.(css|less|sass|scss)$': '<rootDir>/__mocks__/styleMock.js', | ||
| '\\.(gif|ttf|eot|svg)$': '<rootDir>/__mocks__/fileMock.js', | ||
| }, | ||
|
|
||
| // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader | ||
|
|
@@ -102,7 +102,14 @@ module.exports = { | |
| // projects: undefined, | ||
|
|
||
| // Use this configuration option to add custom reporters to Jest | ||
| // reporters: undefined, | ||
| reporters: [ | ||
| 'default', | ||
| ['jest-junit', { | ||
| outputDirectory: './test-results', | ||
| outputName: 'junit-report.xml', | ||
| addFileAttribute: 'true', | ||
| }], | ||
|
Comment on lines
+107
to
+111
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| ], | ||
|
|
||
| // Automatically reset mock state between every test | ||
| // resetMocks: false, | ||
|
|
@@ -140,7 +147,7 @@ module.exports = { | |
| // snapshotSerializers: [], | ||
|
|
||
| // The test environment that will be used for testing | ||
| testEnvironment: "node", | ||
| testEnvironment: 'node', | ||
|
|
||
| // Options that will be passed to the testEnvironment | ||
| // testEnvironmentOptions: {}, | ||
|
|
@@ -179,8 +186,8 @@ module.exports = { | |
|
|
||
| // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation | ||
| transformIgnorePatterns: [ | ||
| '/node_modules/(?!(?:@sendbird/(react-uikit-message-template-view|uikit-message-template))/)' | ||
| ] | ||
| '/node_modules/(?!(?:@sendbird/(react-uikit-message-template-view|uikit-message-template))/)', | ||
| ], | ||
| // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them | ||
| // unmockedModulePathPatterns: undefined, | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.