Skip to content

Commit

Permalink
update buld file
Browse files Browse the repository at this point in the history
  • Loading branch information
corlard3y committed Sep 17, 2024
1 parent 91524f0 commit 4f62b89
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
if: github.event.action != 'closed' # You might want to skip the build if the PR has been closed
run: |
yarn install --frozen-lockfile
yarn build
yarn build:pr:preview
- name: Deploy to GitHub Pages
Expand All @@ -46,5 +46,5 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
destination_dir: pr-preview/pr-${{ github.event.pull_request.number }}
user_name: github-actions[bot]
user_email: 41898282+github-actions[bot]@users.noreply.github.com
# user_name: github-actions[bot]
# user_email: 41898282+github-actions[bot]@users.noreply.github.com
25 changes: 21 additions & 4 deletions build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,28 @@ const envPresets = {
},
};

const isPreview = process.env.REACT_APP_DEPLOY_ENV === 'PREVIEW';

// Define the starting directory
// const __dirname = path.dirname(fileURLToPath(import.meta.url));
// const docsDirectory = path.join(__dirname, '/docs');
// const ogPreviewDirectory = path.join(__dirname, 'static/assets/docs/previews');
// const ogDirectory = __dirname;

// Define the starting directory
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const docsDirectory = path.join(__dirname, '/docs');
const ogPreviewDirectory = path.join(__dirname, 'static/assets/docs/previews');
const ogDirectory = __dirname;
const docsDirectory = isPreview
? path.join(__dirname, `pr-preview/pr-${process.env.GITHUB_PR_NUMBER}/docs`)
: path.join(__dirname, '/docs');
const ogPreviewDirectory = isPreview
? path.join(
__dirname,
`pr-preview/pr-${process.env.GITHUB_PR_NUMBER}/static/assets/docs/previews`
)
: path.join(__dirname, 'static/assets/docs/previews');
const ogDirectory = isPreview
? path.join(__dirname, `pr-preview/pr-${process.env.GITHUB_PR_NUMBER}`)
: __dirname;

// Function to recursively read directories and files
function walkDirectory(currentDirPath, callback) {
Expand Down Expand Up @@ -460,7 +477,7 @@ const prepForDeployment = async (appEnv) => {
process.exit(1);
}

// await changeENV(appEnv);
await changeENV(appEnv);

clearDirectory(ogPreviewDirectory);

Expand Down

0 comments on commit 4f62b89

Please sign in to comment.