Skip to content

Commit c5c3b08

Browse files
authored
fix: Update release.yml (#200)
Another attempt at the copy, commit, and push step in release.yml. This approach ensures that: We start with the dist branch. We get the latest content from main (excluding any existing dist directory). We build the project within the dist branch context, so the dist directory is created as a subdirectory of the checked-out dist branch. We commit and push the changes, including the newly built dist directory, to the dist branch.
1 parent bb22055 commit c5c3b08

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

.github/workflows/release.yml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
- name: Checkout code
3232
uses: actions/checkout@v3
3333
with:
34+
ref: dist
3435
token: ${{ secrets.GH_MERGE_TOKEN }}
3536
fetch-depth: 0
3637

@@ -50,23 +51,29 @@ jobs:
5051
with:
5152
node-version: '22.x'
5253

54+
- name: Fetch Main
55+
run: git fetch origin main:main # Fetch main branch
56+
57+
- name: Copy main to dist (excluding dist directory)
58+
run: |
59+
git checkout main -- . # Checkout all files from main
60+
rm -rf dist # Remove existing dist directory (if any)
61+
5362
- run: npm i
5463
- run: npm run build-all
55-
64+
65+
- name: Commit and Push Changes (to dist)
66+
run: |
67+
git add dist
68+
git commit -m "Update dist folder"
69+
git push --force origin dist
70+
5671
- uses: google-github-actions/auth@v1
5772
with:
5873
credentials_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_KEY }}
59-
74+
6075
- name: Install Firebase CLI
6176
run: npm install -g firebase-tools
62-
77+
6378
- name: Deploy to Firebase Hosting
6479
run: firebase deploy --only hosting
65-
66-
- name: Force Checkout dist and Overwrite
67-
run: |
68-
git fetch origin main
69-
git checkout -B dist origin/main
70-
git add dist
71-
git commit -m "Update dist folder"
72-
git push --force origin dist

0 commit comments

Comments
 (0)