Skip to content

Commit

Permalink
fix: gh-page action
Browse files Browse the repository at this point in the history
  • Loading branch information
daltonmenezes committed Nov 7, 2022
1 parent 5475fa6 commit 3a2bb96
Show file tree
Hide file tree
Showing 10 changed files with 132 additions and 28 deletions.
83 changes: 71 additions & 12 deletions .github/workflows/gh-page.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,84 @@ on:
types:
- "published"

concurrency: ${{ github.workflow }}-${{ github.ref }}
permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: true

jobs:
release:
name: Release
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v3

- name: Detect package manager
id: detect-package-manager
run: |
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
echo "::set-output name=manager::yarn"
echo "::set-output name=command::install"
echo "::set-output name=runner::yarn"
exit 0
elif [ -f "${{ github.workspace }}/package.json" ]; then
echo "::set-output name=manager::npm"
echo "::set-output name=command::ci"
echo "::set-output name=runner::npx --no-install"
exit 0
else
echo "Unable to determine packager manager"
exit 1
fi
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "16"
cache: ${{ steps.detect-package-manager.outputs.manager }}

- name: Setup Pages
uses: actions/configure-pages@v2
with:
static_site_generator: next
generator_config_file: ./apps/web/next.config.mjs

- name: Setup Node.js 16.x
uses: actions/setup-node@v2
- name: Restore cache
uses: actions/cache@v3
with:
node-version: 16.x
path: |
./apps/web/.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
- name: Install Dependencies
run: yarn
- name: Install dependencies
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}

- name: Publish
- name: Build with Next.js
working-directory: ./apps/web
run: yarn deploy
run: ${{ steps.detect-package-manager.outputs.runner }} next build

- name: Static HTML export with Next.js
working-directory: ./apps/web
run: ${{ steps.detect-package-manager.outputs.runner }} next export

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./apps/web/out

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ yarn add use-exit-intent
npm i use-exit-intent
```
# 🐠 Knowledge
- [Docs](https://daltonmenezes.github.io/use-exint-intent/docs/getting-started/overview)
- [Playground](https://daltonmenezes.github.io/use-exint-intent/#playground)
- [Docs](https://daltonmenezes.github.io/use-exit-intent/docs/getting-started/overview)
- [Playground](https://daltonmenezes.github.io/use-exit-intent/#playground)


# 🐠 Contributing
Expand Down
9 changes: 5 additions & 4 deletions apps/web/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import withPlugins from 'next-compose-plugins'
import withTM from 'next-transpile-modules'

const isProd = process.env.NODE_ENV === 'production'

/** @type {import('next').NextConfig} */
Expand All @@ -14,6 +11,10 @@ const nextConfig = {
assetPrefix: isProd ? '/use-exit-intent/' : '',
},

experimental: {
transpilePackages: ['use-exit-intent'],
},

pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],

redirects() {
Expand All @@ -27,4 +28,4 @@ const nextConfig = {
},
}

export default withPlugins([withTM(['use-exit-intent'])], nextConfig)
export default nextConfig
6 changes: 2 additions & 4 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
"build": "next build && next export",
"start": "next start",
"lint": "next lint",
"predeploy": "git config user.email \"[email protected]\" && git config user.name \"Dalton Menezes\"",
"deploy": "next build && next export && touch out/.nojekyll && git add -f out/ && git commit -m \"ci: deploy changes\" && git subtree push --prefix out origin gh-pages"
"clean": "rm -rf .turbo && rm -rf node_modules"
},
"dependencies": {
"@mdx-js/loader": "^2.1.5",
Expand All @@ -21,7 +20,6 @@
"framer-motion": "^7.6.4",
"gray-matter": "^4.0.3",
"next": "12.3.2",
"next-compose-plugins": "^2.2.1",
"next-mdx-remote": "^4.1.0",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand All @@ -31,7 +29,7 @@
"remark-frontmatter": "^4.0.1",
"remark-gfm": "^3.0.1",
"turbo": "1.5.6",
"use-exit-intent": "*"
"use-exit-intent": "latest"
},
"devDependencies": {
"@babel/core": "^7.0.0",
Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Document, { Head, Html, Main, NextScript } from 'next/document'

import { getPublicPath } from 'shared/utils'
import { getCssText } from 'styles'

export default class CustomDocument extends Document {
Expand All @@ -11,7 +12,7 @@ export default class CustomDocument extends Document {

<link rel="preconnect" href="https://fonts.googleapis.com" />

<link rel="icon" href="/favicon.ico" />
<link rel="icon" href={getPublicPath('/favicon.ico')} />

<link
rel="preconnect"
Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/shared/constants/meta.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { getPublicPath } from 'shared/utils'
import { library } from './library'

export const meta = {
Expand All @@ -9,7 +10,7 @@ export const meta = {
},

image: {
url: `/social.png`,
url: getPublicPath(`/social.png`),
width: '1200',
height: '630',
},
Expand Down
18 changes: 18 additions & 0 deletions packages/use-exit-intent/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# use-exit-intent

## 1.0.4

### Patch Changes

- fix readme

## 1.0.3

### Patch Changes

- fix readme

## 1.0.2

### Patch Changes

- fix readme

## 1.0.1

### Patch Changes
Expand Down
6 changes: 3 additions & 3 deletions packages/use-exit-intent/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align="center">
<a href="#use-exit-intent">
<img alt="preview" src="../../apps/web/public/banner.svg" width="100%">
<img alt="preview" src="https://github.com/daltonmenezes/use-exit-intent/raw/main/apps/web/public/banner.svg" width="100%">
</a>
</p>

Expand Down Expand Up @@ -44,8 +44,8 @@ yarn add use-exit-intent
npm i use-exit-intent
```
# 🐠 Knowledge
- [Docs](https://daltonmenezes.github.io/use-exint-intent/docs/getting-started/overview)
- [Playground](https://daltonmenezes.github.io/use-exint-intent/#playground)
- [Docs](https://daltonmenezes.github.io/use-exit-intent/docs/getting-started/overview)
- [Playground](https://daltonmenezes.github.io/use-exit-intent/#playground)


# 🐠 Contributing
Expand Down
26 changes: 26 additions & 0 deletions packages/use-exit-intent/docs/banner.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/use-exit-intent/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "use-exit-intent",
"version": "1.0.1",
"version": "1.0.4",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "dist/index.d.ts",
Expand Down

0 comments on commit 3a2bb96

Please sign in to comment.