-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (61 loc) · 1.98 KB
/
ci.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
name: Continuous Integration and Deployment
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
continuous_integration:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
steps:
- name: Checkout code 🛎️
uses: actions/checkout@v3
with:
clean: true
- name: Set Node Version
uses: actions/setup-node@v3
with:
node-version: 20.13.1
- name: Setup .npmrc file
run: |
echo "@3um-group:registry=https://npm.pkg.github.com/" > ~/.npmrc
echo "//npm.pkg.github.com/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
- name: Install Packages
run: npm install --legacy-peer-deps
# - name: Run Test
# run: npm run test
- name: Build Project
run: npm run build
- name: Check for .codesandbox/tasks.json
run: |
if [ ! -f .codesandbox/tasks.json ]; then
echo "Error: .codesandbox/tasks.json not found"
exit 1
fi
- name: Deploy to CodeSandbox
env:
CODESANDBOX_TOKEN: ${{ secrets.CODESANDBOX_API_TOKEN }}
run: |
# Install CodeSandbox CLI
npm install -g codesandbox
# Deploy to CodeSandbox
SANDBOX_URL=$(codesandbox deploy --json | jq -r '.url')
echo "Sandbox URL: $SANDBOX_URL"
echo "SANDBOX_URL=$SANDBOX_URL" >> $GITHUB_ENV
- name: Comment PR
uses: actions/github-script@v6
if: github.event_name == 'pull_request'
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Deployed to CodeSandbox: ${process.env.SANDBOX_URL}`
})