-
Notifications
You must be signed in to change notification settings - Fork 43
86 lines (68 loc) · 2.73 KB
/
dev.yaml
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
79
80
81
82
83
84
85
86
name: Dev release pipeline
on:
pull_request:
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
jobs:
sync_dev:
runs-on: ubuntu-latest
environment:
name: dev/${{ github.event.pull_request.number }}
url: https://ui-kit.dev.amity.co/${{ github.event.pull_request.number }}
env:
NPM_FONT_AWESOME_TOKEN: ${{ secrets.NPM_FONT_AWESOME_TOKEN }}
STORYBOOK_API_REGION: ${{ secrets.STORYBOOK_API_REGION }}
STORYBOOK_API_KEY: ${{ secrets.STORYBOOK_API_KEY }}
STORYBOOK_USERS: ${{ secrets.STORYBOOK_USERS }}
steps:
- name: git checkout
uses: actions/checkout@v4
- name: install node
uses: actions/setup-node@v4
with:
node-version-file: .tool-versions
- uses: pnpm/action-setup@v4
with:
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path | tr -d '\n')" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: build storybook
run: pnpm run storybook:build
- name: get version
id: version
run: echo "current_version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: increase version (pre-release)
run: pnpm standard-version --release-as ${{ steps.version.outputs.current_version }} --prerelease alpha.$(git rev-parse --short HEAD) --skip.changelog --skip.commit --skip.tag
- name: unpublish old version
if: "contains(github.event.pull_request.title, '(sdk):')"
continue-on-error: true
run: |
prev=$(npm view @amityco/ui-kit dist-tags.dev/${{ github.event.pull_request.number }})
[[ ! -z $prev ]] && npm unpublish @amityco/ui-kit@$prev
- name: build
run: pnpm run build
- name: publish on npm with dev dist-tag
if: "contains(github.event.pull_request.title, '(sdk):')"
continue-on-error: true
run: npm publish --tag dev/${{ github.event.pull_request.number }}
- name: publish on s3
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_S3_BUCKET: ui-kit.dev.amity.co
SOURCE_DIR: ./storybook-build
DEST_DIR: ${{ github.event.pull_request.number }}