-
Notifications
You must be signed in to change notification settings - Fork 31
124 lines (107 loc) · 3.81 KB
/
build-test-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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: Run build, test & publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }}
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
on:
workflow_dispatch:
push:
branches:
- develop
- beta
- nightly
pull_request:
branches:
- develop
jobs:
build-lint-test:
if: contains(github.event.pull_request.title, ':tada:') == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Repo
uses: ./tools/github/setup-repo
- name: Build
run: bun install; bun run build
- name: Lint Packages
run: |
bun --filter='./packages/toolboxes/**' lint && bun --filter='./packages/toolboxes/**' type-check
bun --filter='./packages/wallets/**' lint && bun --filter='./packages/wallets/**' type-check
bun --filter='./packages/plugins/**' lint && bun --filter='./packages/plugins/**' type-check
bun --filter='./packages/swapkit/**' lint && bun --filter='./packages/swapkit/**' type-check
- name: Lint Playgrounds
continue-on-error: true
run: bun --filter='./playgrounds/**' lint && bun --filter='./playgrounds/**' type-check
- name: Test
if: contains(github.ref_name, 'nightly') == false
run: bun run test
publish:
if: contains(github.ref_name, 'develop') || contains(github.ref_name, 'nightly') || contains(github.ref_name, 'beta')
needs: [build-lint-test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Repo
uses: ./tools/github/setup-repo
- name: Replace versions
run: bun run ./scripts/replace-versions.ts
- name: Copy npmrc config
run: cp .npmrc.prod .npmrc
- name: Change nightly changeset
if: contains(github.ref_name, 'nightly')
run: |
bun changeset version --snapshot nightly
- name: Change beta changeset
if: contains(github.ref_name, 'beta')
run: |
echo 'publishName="Beta"' >> $GITHUB_OUTPUT
bun changeset pre enter beta
bun changeset version
- name: Set job params
shell: bash
id: deployment-params
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
echo "publishName=${{ github.ref_name == 'develop' && 'Release' || github.ref_name }}" >> $GITHUB_OUTPUT
- name: Create Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
if: contains(github.ref_name, 'develop')
with:
title: ":tada: Publish ${{ steps.deployment-params.outputs.publishName }}"
version: bun version-bump
publish: bun publish-packages
setupGitUser: false
- name: Publish Nightly to npm
uses: changesets/action@v1
if: contains(github.ref_name, 'nightly')
with:
title: ":tada: Publish Nightly"
version: bun version-bump
publish: bun publish-packages --tag nightly
setupGitUser: false
deploy-playground:
if: contains(github.ref_name, 'develop')
needs: [build-lint-test]
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Setup Repo
uses: ./tools/github/setup-repo
- name: Setup Pages
uses: actions/[email protected]
- name: Build playground
run: |
bun run build
bun playground:vite build-playground
- name: Upload artifact
uses: actions/[email protected]
with:
path: "./playgrounds/vite/dist"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/[email protected]