Skip to content

Merged Website to Astro! #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .firebaserc

This file was deleted.

40 changes: 0 additions & 40 deletions .github/workflows/firebase-hosting-merge.yml

This file was deleted.

41 changes: 0 additions & 41 deletions .github/workflows/firebase-hosting-pull-request.yml

This file was deleted.

76 changes: 76 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: PR Preview Workflow

on:
pull_request_target:
types: [opened, synchronize, closed]

jobs:
build-and-preview:
if: github.event.action == 'opened' || github.event.action == 'synchronize'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: Install dependencies
run: npm install

- name: Build the website
run: npm run build

- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: ./dist
target-folder: pr-previews/${{ github.event.pull_request.number }}
clean: false
commit-message: Deploy preview for PR ${{ github.event.pull_request.number }}
token: ${{ secrets.GITHUB_TOKEN }}

comment-preview-url:
needs: build-and-preview
if: needs.build-and-preview.result == 'success'
runs-on: ubuntu-latest
steps:
- name: Comment Preview URL
uses: thollander/actions-comment-pull-request@v2
with:
message: |
<!-- preview-url-comment -->
Preview the changes: https://shravanngoswamii.github.io/portfolio/pr-previews/${{ github.event.pull_request.number }}
Please avoid using the search feature and navigation bar in PR previews!
comment_tag: preview-url-comment
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

delete-preview-directory:
if: github.event.action == 'closed' || github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout gh-pages branch
uses: actions/checkout@v4
with:
ref: gh-pages

- name: Remove PR Preview Directory
run: |
PR_NUMBER=${{ github.event.pull_request.number }}
PREVIEW_DIR="pr-previews/${PR_NUMBER}"
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git pull origin gh-pages
rm -rf ${PREVIEW_DIR}
git add .
git commit -m "Remove preview for merged PR #${PR_NUMBER}"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44 changes: 44 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Deploy Website

on:
push:
branches:
- astro-merge
jobs:
deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: Install dependencies
run: npm install

- name: Build the website
run: npm run build

- name: Print current time
run: date

# Will use this after this branch becomes main
# - name: Deploy to gh-pages branch
# uses: JamesIves/github-pages-deploy-action@v4
# with:
# branch: gh-pages
# folder: ./dist
# clean: false

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: dist
publish_branch: gh-pages
cname: blog.shravangoswami.com

permissions:
contents: write
75 changes: 32 additions & 43 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,43 +1,32 @@
# Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode,firebase
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,firebase

### Firebase ###
.idea
**/node_modules/*
# **/.firebaserc
# firestore.json

### Firebase Patch ###
.runtimeconfig.json
.firebase/
# Ignore GitHub workflow files
# .github/workflows/*
# .github

# scripts/contact.js

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide
.env

build/
node_modules/
.docusaurus/

# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,firebase
# build output
dist/
.output/

# dependencies
node_modules/

# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*


# environment variables
.env
.env.production

# macOS-specific files
.DS_Store

# ignore .astro directory
.astro

# yarn
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
.pnp.*
34 changes: 34 additions & 0 deletions .vscode/astro-paper.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"Frontmatter": {
"scope": "markdown",
"prefix": "frontmatter",
"body": [
"---",
"author: $1",
"pubDatetime: $CURRENT_YEAR-$CURRENT_MONTH-${CURRENT_DATE}T$CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND.000$CURRENT_TIMEZONE_OFFSET",
"modDatetime: $3",
"title: $4",
"featured: ${5|false,true|}",
"draft: ${6|true,false|}",
"tags:",
" - $7",
"description: $8",
"---",
],
"description": "Adds the frontmatter block for the AstroPaper Blog post"
},
"Blog Template": {
"scope": "markdown",
"prefix": "template",
"body": [
"${1:frontmatter}",
"",
"${2: Introductory Sentence}",
"",
"## Table of contents",
"",
"## ${3: heading 1}",
],
"description": "Adds the template for the AstroPaper Blog post. You will need to trigger the snippet modal on the 'frontmatter' line to insert the other snipper."
}
}
4 changes: 4 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"recommendations": ["astro-build.astro-vscode"],
"unwantedRecommendations": []
}
11 changes: 11 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "./node_modules/.bin/astro dev",
"name": "Development server",
"request": "launch",
"type": "node-terminal"
}
]
}
Loading
Loading