Skip to content

Use cloc for counting lines of code and comments #390

Use cloc for counting lines of code and comments

Use cloc for counting lines of code and comments #390

Workflow file for this run

# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Deploy
on:
push:
branches: [ main, '*staging*', 'rapid-v1.x' ]
permissions:
id-token: write # required to use OIDC authentication
contents: read # required to checkout the code from the repo
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout 📥
uses: actions/checkout@v3
- name: Use Node.js 16.14 ⚙️
uses: actions/setup-node@v3
with:
node-version: 16.14
- name: Install 🎯
run: npm install
- name: Run 🏃
run: npm run all
- name: Test 🧪
run: npm run test
- name: Upload artifacts 📤
uses: actions/upload-artifact@v3
with:
name: build-artifacts
path: dist
if-no-files-found: error
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout 📥
uses: actions/checkout@v3
- name: Download artifacts 📥
uses: actions/download-artifact@v3
with:
name: build-artifacts
path: dist
- name: Configure AWS credentials 🔐
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_RAPID_DEPLOY_ROLE_ARN }}
role-duration-seconds: 900 # the ttl of the session, in seconds.
aws-region: us-west-2
- name: Setup vars 📋
id: vars
run: |
echo "identifier=$(git rev-parse --short ${{ github.sha }})-16.x" >> "$GITHUB_ENV"
echo "distdir=$(git rev-parse --short ${{ github.sha }})-16.x-" >> "$GITHUB_ENV"
- name: Prep files 🔨
run: npm run aws_deploy
env:
IDENTIFIER: ${{ env.identifier }}
DISTDIR: ${{ env.distdir }}
- name: Copy new index file to S3 📤
run: aws s3 cp $DISTDIR/index.html s3://world.ai.rapid/rapid/$IDENTIFIER-rapid.html --no-progress
env:
IDENTIFIER: ${{ env.identifier }}
DISTDIR: ${{ env.distdir }}
- name: Copy new dist dir to S3 📤
run: aws s3 cp $DISTDIR s3://world.ai.rapid/rapid/$DISTDIR --recursive --no-progress
env:
IDENTIFIER: ${{ env.identifier }}
DISTDIR: ${{ env.distdir }}
- name: Deployment complete! 🚀
run: |
echo "Your build is here: https://mapwith.ai/rapid/${{ env.distdir }}/index.html"