Skip to content
This repository has been archived by the owner on Dec 30, 2023. It is now read-only.

Commit

Permalink
Add automatic deploy and favicon
Browse files Browse the repository at this point in the history
  • Loading branch information
seia-soto committed Mar 3, 2021
1 parent 9c47b8e commit cf2f482
Show file tree
Hide file tree
Showing 7 changed files with 486 additions and 16 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Deploy to production

on: [
push
]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: amondnet/vercel-action@v20
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }} # Required
github-token: ${{ secrets.GITHUB_TOKEN }} # Optional
vercel-args: '--prod' # Optional
vercel-org-id: ${{ secrets.ORG_ID }} # Required
vercel-project-id: ${{ secrets.PROJECT_ID }} # Required
working-directory: ./
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,5 @@ dist
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

.vercel
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"build": "next build",
"start": "next start",
"export": "next build && next export && yarn sitemap && yarn mkstatic",
"serve": "serve out",
"lint": "eslint --ext .js",
"sitemap": "yarn node scripts/sitemap",
"mkstatic": "yarn node scripts/mkstatic"
Expand Down Expand Up @@ -48,6 +49,7 @@
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.3.1",
"eslint-plugin-react": "^7.22.0"
"eslint-plugin-react": "^7.22.0",
"serve": "^11.3.2"
}
}
4 changes: 4 additions & 0 deletions pages/_app.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react'
import * as PropTypes from 'prop-types'
import Head from 'next/head'
import { useRouter } from 'next/router'
import { NextSeo } from 'next-seo'
import {
Expand Down Expand Up @@ -41,6 +42,9 @@ const App = ({ Component, pageProps }) => {
title={site.name}
description='Just a blog, __init__?'
/>
<Head>
<link rel='shortcut icon' href='/static/typed.icon.png' />
</Head>
<Box
background='black'
marginBottom='25px'
Expand Down
6 changes: 6 additions & 0 deletions scripts/mkstatic.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
console.log('Copying static assets from post directory')

const esm = require('esm')
const fs = require('fs')
const path = require('path')
Expand All @@ -22,10 +24,14 @@ for (let i = 0, l = slugs.length; i < l; i++) {
.readdirSync(postDir)
.filter(filename => filename !== 'index.mdx')

console.log('Found new post:', slug, 'with', assets.length, 'assets')

for (let k = 0, s = assets.length; k < s; k++) {
const origin = path.join(postDir, assets[k])
const target = path.join(assetsDir, assets[k])

console.log('Copying', origin, 'to', target)

fs.copyFileSync(origin, target)
}
}
4 changes: 4 additions & 0 deletions scripts/sitemap.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
console.log('Creating sitemap from directory hierarchy')

const esm = require('esm')
const fs = require('fs')
const path = require('path')
Expand All @@ -12,4 +14,6 @@ sitemap
const file = path.resolve(process.cwd(), 'out/sitemap.xml')

fs.writeFileSync(file, data.toString(), 'utf8')

console.log('Wrote into', file)
})
Loading

2 comments on commit cf2f482

@github-actions
Copy link

@github-actions github-actions bot commented on cf2f482 Mar 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for typed-sh ready!

✅ Preview
https://typed-sh-8i9da4e4e-seia.vercel.app

Built with commit cf2f482.
This pull request is being automatically deployed with vercel-action

@vercel
Copy link

@vercel vercel bot commented on cf2f482 Mar 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.