Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

Fix(ops): Deploy to remote repository was not working

Jonathan ARNAULTf8674684bcd5
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 8c9283c9..91fa7509 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -25,7 +25,6 @@ jobs:
VITE_SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
VITE_SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }}
VITE_IS_DEMO: ${{ vars.VITE_IS_DEMO }}
- DEPLOY_REPO_URL: 'https://git:${{ secrets.GITHUB_TOKEN }}@github.com/${{ vars.DEPLOY_REPOSITORY || github.repository }}'
steps:
- name: 📥 Checkout repo
@@ -64,8 +63,10 @@ jobs:
- name: 📡 Deploy GitHub pages
run: |
echo "Deploying to pages to ${DEPLOY_REPO_URL}"
+ git remote set-url origin https://git:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}
+ git remote set-url production https://git:${{ secrets.GITHUB_TOKEN }}@github.com/${{ vars.DEPLOY_REPOSITORY || github.repository }}
git config --global user.email [email protected]
git config --global user.name github-actions-bot
- npm run ghpages:deploy
+ npx gh-pages --remote production -d dist -b ${{ vars.DEPLOY_BRANCH || 'gh-pages' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/doc/github-actions.md b/doc/github-actions.md
index 22632d39..800c57c8 100644
--- a/doc/github-actions.md
+++ b/doc/github-actions.md
@@ -20,7 +20,16 @@ POSTMARK_WEBHOOK_AUTHORIZED_IPS: List of IPs (comma separated) authorized to sen
## Deploying to Another Repository
-If you want to deploy the static website to another repository, you can configure the following variable on you repository:
+Warning: The deploy repository MUST be in the same GitHub `org` as the `atomic-crm` repository.
+
+If you want to deploy the static website to another repository, you must first
+
+Then you can configure the following GitHub action variable on you repository:
+```bash
+DEPLOY_REPOSITORY=<org>/<repository>
+```
+
+You can also configure the deploy branch using
```bash
[email protected]:<org>/<repository>.git
+DEPLOY_BRANCH=main # Defaults to `gh-pages`
```
diff --git a/scripts/ghpages-deploy.mjs b/scripts/ghpages-deploy.mjs
index dade1fe2..cfc11bd3 100644
--- a/scripts/ghpages-deploy.mjs
+++ b/scripts/ghpages-deploy.mjs
@@ -3,7 +3,7 @@ import * as ghpages from 'gh-pages';
ghpages.publish(
'dist',
{
- branch: 'gh-pages',
+ branch: process.env.DEPLOY_BRANCH || 'gh-pages',
repo: process.env.DEPLOY_REPO_URL || undefined,
},
function (err) {