From 0d10630cacda59eec32e1308ee712c57fadee0a1 Mon Sep 17 00:00:00 2001 From: Pranab Das <31024886+pranabdas@users.noreply.github.com> Date: Tue, 15 Oct 2024 17:28:30 +0800 Subject: [PATCH] upgrade deps + update tax rates + deploy via gh actions --- .github/workflows/deploy.yml | 37 + .gitignore | 2 +- gh_deploy_amend.sh | 27 - public/index.html => index.html | 3 +- package-lock.json | 25749 +----------------------------- package.json | 29 +- public/.nojekyll | 0 src/{App.js => App.jsx} | 16 +- src/index.js | 11 - src/index.jsx | 7 + vite.config.js | 11 + 11 files changed, 959 insertions(+), 24933 deletions(-) create mode 100644 .github/workflows/deploy.yml delete mode 100644 gh_deploy_amend.sh rename public/index.html => index.html (87%) delete mode 100644 public/.nojekyll rename src/{App.js => App.jsx} (92%) delete mode 100644 src/index.js create mode 100644 src/index.jsx create mode 100644 vite.config.js diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..21aa56c --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,37 @@ +name: Deploy gh-pages + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + permissions: + contents: write + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + + steps: + - uses: actions/checkout@v4 + + - name: Setup Node environment + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install NPM packages + run: npm install + + - name: Build website + run: npm run build + + - name: Deploy on gh-pages + uses: peaceiris/actions-gh-pages@v4 + if: ${{ github.ref == 'refs/heads/main' }} + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./dist + user_name: 'github-actions[bot]' + user_email: 'github-actions[bot]@users.noreply.github.com' diff --git a/.gitignore b/.gitignore index 4d29575..2fa56e4 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,7 @@ /coverage # production -/build +/dist # misc .DS_Store diff --git a/gh_deploy_amend.sh b/gh_deploy_amend.sh deleted file mode 100644 index 363d6f3..0000000 --- a/gh_deploy_amend.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -if [ -d "tmpghdeploy" ] ; then - rm -rf tmpghdeploy -fi - -if [ -d "build" ] ; then - rm -rf build -fi - -echo "Building site ..." -npm run build &> /dev/null - - -mkdir tmpghdeploy -cd tmpghdeploy - -echo "Cloning gh-pages branch ..." -git clone --branch gh-pages https://github.com/pranabdas/sg-tax-calculator -cd .. -rsync -azh --exclude .git --delete build/ tmpghdeploy/sg-tax-calculator -cd tmpghdeploy/sg-tax-calculator -find . -type f -name .DS_Store -delete &> /dev/null -git add --all && git commit --amend --no-edit &> /dev/null -git push origin gh-pages --force &> /dev/null -echo "Deployed." -cd ../.. -rm -rf tmpghdeploy diff --git a/public/index.html b/index.html similarity index 87% rename from public/index.html rename to index.html index 0169160..8a2f133 100644 --- a/public/index.html +++ b/index.html @@ -2,13 +2,14 @@ - + Singapore tax calculator
+