Skip to content

Commit

Permalink
github actions setup
Browse files Browse the repository at this point in the history
  • Loading branch information
JaveedIshaq committed Dec 15, 2024
1 parent 408ad50 commit b9c4f23
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 1 deletion.
40 changes: 40 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Deploy to GitHub Pages

on:
push:
branches:
- main # or your default branch
workflow_dispatch:

jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

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

- name: Install dependencies
run: npm ci

- name: Set up environment variables
run: |
echo "EMAILJS_PUBLIC_KEY=${{ secrets.EMAILJS_PUBLIC_KEY }}" >> $GITHUB_ENV
echo "EMAILJS_SERVICE_ID=${{ secrets.EMAILJS_SERVICE_ID }}" >> $GITHUB_ENV
echo "EMAILJS_TEMPLATE_ID=${{ secrets.EMAILJS_TEMPLATE_ID }}" >> $GITHUB_ENV
- name: Build
run: npm run build -- --configuration production --base-href "https://javeedishaq.github.io/"

- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: dist/ngdevfolio/browser
token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"customWebpackConfig": {
"path": "./custom-webpack.config.js"
},
"outputPath": "dist/ngdevfolio",
"outputPath": "dist/ngdevfolio/browser",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": [
Expand Down
24 changes: 24 additions & 0 deletions src/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Redirecting...</title>
<script type="text/javascript">
// Single Page Apps for GitHub Pages
// MIT License
// https://github.com/rafgraph/spa-github-pages
var pathSegmentsToKeep = 0;

var l = window.location;
l.replace(
l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') +
l.pathname.split('/').slice(0, 1 + pathSegmentsToKeep).join('/') + '/?/' +
l.pathname.slice(1).split('/').slice(pathSegmentsToKeep).join('/').replace(/&/g, '~and~') +
(l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') +
l.hash
);
</script>
</head>
<body>
</body>
</html>

0 comments on commit b9c4f23

Please sign in to comment.