-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Deploy to Github Pages | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
gh-pages-deploy: | ||
name: Deploying to Github Pages | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '12' | ||
- name: Install packages | ||
run: npm i | ||
- name: Set Creds | ||
run: git config user.name "IASV" && git config user.email "ivanantoniosuarezvillalba@gmail.com" | ||
- name: Deploy | ||
run: npm run deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* eslint-disable no-console */ | ||
const execa = require("execa"); | ||
const fs = require("fs"); | ||
(async () => { | ||
try { | ||
await execa("git", ["checkout", "--orphan", "gh-pages"]); | ||
// eslint-disable-next-line no-console | ||
console.log("Building started..."); | ||
await execa("npm", ["run", "build"]); | ||
// await execa("yarn", ["build"]); | ||
// Understand if it's dist or build folder | ||
const folderName = fs.existsSync("dist") ? "dist" : "build"; | ||
await execa("git", ["--work-tree", folderName, "add", "--all"]); | ||
await execa("git", ["--work-tree", folderName, "commit", "-m", "gh-pages"]); | ||
console.log("Pushing to gh-pages..."); | ||
await execa("git", ["push", "origin", "HEAD:gh-pages", "--force"]); | ||
await execa("rm", ["-r", folderName]); | ||
await execa("git", ["checkout", "-f", "main"]); | ||
await execa("git", ["branch", "-D", "gh-pages"]); | ||
console.log("Successfully deployed, check your settings"); | ||
} catch (e) { | ||
// eslint-disable-next-line no-console | ||
console.log(e.message); | ||
process.exit(1); | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
publicPath: process.env.NODE_ENV === 'production' ? '/my-portfolio' : '/', | ||
}; |