From 27c33c422895b67c23e74358e0f2552671a73fd3 Mon Sep 17 00:00:00 2001 From: antidoid Date: Tue, 30 Jan 2024 17:10:33 +0530 Subject: [PATCH] Setup: Deployment --- .devcontainer/Dockerfile | 13 ++++++ .devcontainer/devcontainer.json | 16 ++++++++ .github/workflows/deploy-webpage.yml | 59 ++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 .github/workflows/deploy-webpage.yml diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..ab1a940 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,13 @@ +FROM jetpackio/devbox:latest + +# Installing your devbox project +WORKDIR /code +USER ${DEVBOX_USER}:${DEVBOX_USER} +COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.json devbox.json +COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.lock devbox.lock + + + +RUN devbox run -- echo "Installed Packages." + +RUN devbox shellenv --init-hook >> ~/.profile diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..e7ae9f1 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,16 @@ +{ + "name": "Devbox Remote Container", + "build": { + "dockerfile": "./Dockerfile", + "context": ".." + }, + "customizations": { + "vscode": { + "settings": {}, + "extensions": [ + "jetpack-io.devbox" + ] + } + }, + "remoteUser": "devbox" +} \ No newline at end of file diff --git a/.github/workflows/deploy-webpage.yml b/.github/workflows/deploy-webpage.yml new file mode 100644 index 0000000..7f530ed --- /dev/null +++ b/.github/workflows/deploy-webpage.yml @@ -0,0 +1,59 @@ +name: Deploy to GH Pages + +on: + push: + branches: + - main + paths: + - "frontend/**" + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow one concurrent deployment +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up Node + uses: actions/setup-node@v3 + with: + node-version: 20 + cache: "npm" + cache-dependency-path: "./frontend/package-lock.json" + + - name: Install Dependencies and Build + run: "cd ./frontend && npm install && npm run build" + env: + VITE_FUNCTION_URL: ${{ secrets.VITE_FUNCTION_URL }} + + - name: Setup Pages + uses: actions/configure-pages@v3 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 + with: + name: frontend-dist # Set a name for the artifact + path: "./frontend/dist" # Upload the dist directory within /frontend + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 + with: + artifact_name: frontend-dist