Skip to content

DAPP1-87: updated ci file #29

DAPP1-87: updated ci file

DAPP1-87: updated ci file #29

Workflow file for this run

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
- name: Run Test
run: npm run test
- name: Build Project
run: npm run build
- name: Deploy to CodeSandbox
env:
CODESANDBOX_API_TOKEN: ${{ secrets.CODESANDBOX_API_TOKEN }}
run: |
# Install CodeSandbox CLI
npm install -g codesandbox
# Log in to CodeSandbox
echo $CODESANDBOX_API_TOKEN | codesandbox login
# Create or update sandbox
codesandbox deploy -s .
# Get the sandbox URL and output it
SANDBOX_URL=$(codesandbox deploy -s . | grep -o 'https://.*')
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}`
})