-
Notifications
You must be signed in to change notification settings - Fork 17
78 lines (76 loc) · 2.93 KB
/
package-publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: publish
on:
workflow_dispatch:
inputs:
version:
description: 'version'
required: true
type: string
npm_tag:
description: 'release tag'
required: false
type: string
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Check if the release branch exists
run: |
set -x
branch_name="release/v${{ github.event.inputs.version }}"
if ! git ls-remote --exit-code --heads origin "$branch_name" > /dev/null; then
echo "Branch $branch_name does not exist. Make sure to create the branch and create a Jira ticket with pr-comment-bot."
exit 1
fi
- name: Install and Build
run: |
npm install
touch .env.production
echo "VITE_CHAT_AI_WIDGET_KEY=${{ secrets.chat_ai_widget_key }}" >> .env.production
npm run build:npm
- name: Publish to npm
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.npm_token }}" >> .npmrc
if [ -z "${{ github.event.inputs.npm_tag }}" ]; then
npm publish --access=public
else
npm publish --tag ${{ github.event.inputs.npm_tag }} --access=public
fi
- name: Set environments
run: |
git config --global user.name "sendbird-sdk-deployment"
git config --global user.email "sha.sdk_deployment@sendbird.com"
echo "RELEASE_DATE=$(date +'%b %d %Y')" >> $GITHUB_ENV
echo "LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_ENV
- name: Generate CHANEGLOG
run: |
echo "## [$LATEST_TAG] - $RELEASE_DATE" > temp-changelog.md
git log $LATEST_TAG..develop --oneline >> temp-changelog.md
echo "" >> temp-changelog.md
cat CHANGELOG.md >> temp-changelog.md
mv temp-changelog.md CHANGELOG.md
git commit -m "Update CHANGELOG.md for $LATEST_TAG"
git push origin release/v${{ github.event.inputs.version }}
- name: Update installed chat-ai-widget version to latest under packages/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
packages=( "url-webdemo" "self-service" )
for package in "${packages[@]}"; do
cd ./packages/$package
npm install @sendbird/chat-ai-widget@${{ github.event.inputs.version }}
cd -
done
git add .
git commit -m "chore: update chat-ai-widget version to v${{ github.event.inputs.version }}"
git push origin release/v${{ github.event.inputs.version }}
- name: Tag new target and push to origin
run: |
git tag v${{ github.event.inputs.version }}
git push origin v${{ github.event.inputs.version }}