From 0fa791aefbe1b029d4b80369e4658634c80d2f33 Mon Sep 17 00:00:00 2001 From: Lost Paul <70213368+LostPaul@users.noreply.github.com> Date: Thu, 20 Feb 2025 10:53:42 +0100 Subject: [PATCH 1/5] Update create-release-for-fv.yaml --- .github/workflows/create-release-for-fv.yaml | 28 ++++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/create-release-for-fv.yaml b/.github/workflows/create-release-for-fv.yaml index 94a2547..ff20f8c 100644 --- a/.github/workflows/create-release-for-fv.yaml +++ b/.github/workflows/create-release-for-fv.yaml @@ -14,7 +14,6 @@ jobs: build-and-push: runs-on: ubuntu-latest steps: - # Checkout folder-notes repository - name: Checkout folder-notes uses: actions/checkout@v3 with: @@ -23,48 +22,52 @@ jobs: submodules: recursive path: folder-notes - # Install dependencies and run the fv-build process + - name: Force update submodules + run: | + cd folder-notes + git submodule sync --recursive + git submodule update --init --recursive --force + + - name: Reset submodule to latest commit + run: | + cd folder-notes/src/obsidian-folder-overview + git fetch origin main + git checkout origin/main + - name: Run npm install and build in folder-notes run: | cd folder-notes npm install npm run fv-build - # Verify that the built files exist - - name: Check built files + - name: Verify built files run: | ls -la folder-notes/src/obsidian-folder-overview/ - # Checkout folder-overview repository on the main branch - name: Checkout folder-overview uses: actions/checkout@v3 with: repository: LostPaul/obsidian-folder-overview token: ${{ secrets.PAT }} - ref: main # Ensures we are on the main branch + ref: main path: folder-overview - # Ensure we're on the main branch - name: Ensure we are on main branch run: | cd folder-overview git checkout main || git checkout -b main - # Copy the built files from folder-notes to folder-overview - name: Copy built files to folder-overview run: | cp folder-notes/src/obsidian-folder-overview/main.js \ folder-notes/src/obsidian-folder-overview/styles.css folder-overview/ - # Commit and push built files only if they changed - name: Commit and push built files run: | cd folder-overview git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" git add main.js styles.css - - # Only commit if there are changes if git diff --cached --quiet; then echo "No changes to commit." else @@ -72,7 +75,6 @@ jobs: git push origin main fi - # Trigger release workflow in folder-overview - name: Trigger release workflow in folder-overview run: | curl -X POST -H "Authorization: token ${{ secrets.PAT }}" \ @@ -84,7 +86,6 @@ jobs: needs: build-and-push runs-on: ubuntu-latest steps: - # Checkout folder-overview again for cleanup - name: Checkout folder-overview for cleanup uses: actions/checkout@v3 with: @@ -93,7 +94,6 @@ jobs: ref: main path: folder-overview - # Remove built files after release - name: Remove built files after release run: | cd folder-overview From 086c791a82cf9dc6e4f101ba44464bb0e8deb84e Mon Sep 17 00:00:00 2001 From: Lost Paul <70213368+LostPaul@users.noreply.github.com> Date: Thu, 20 Feb 2025 11:13:30 +0100 Subject: [PATCH 2/5] Update create-release-for-fv.yaml --- .github/workflows/create-release-for-fv.yaml | 54 +++----------------- 1 file changed, 8 insertions(+), 46 deletions(-) diff --git a/.github/workflows/create-release-for-fv.yaml b/.github/workflows/create-release-for-fv.yaml index ff20f8c..2ae4ae9 100644 --- a/.github/workflows/create-release-for-fv.yaml +++ b/.github/workflows/create-release-for-fv.yaml @@ -22,27 +22,20 @@ jobs: submodules: recursive path: folder-notes - - name: Force update submodules - run: | - cd folder-notes - git submodule sync --recursive - git submodule update --init --recursive --force - - - name: Reset submodule to latest commit - run: | - cd folder-notes/src/obsidian-folder-overview - git fetch origin main - git checkout origin/main - - - name: Run npm install and build in folder-notes + - name: Install dependencies run: | cd folder-notes npm install - npm run fv-build - - name: Verify built files + - name: Build folder-overview + run: | + cd folder-notes + npm run fv-build # This will run esbuild.config.mjs + + - name: Verify build output run: | ls -la folder-notes/src/obsidian-folder-overview/ + ls -la folder-notes/dist/ - name: Checkout folder-overview uses: actions/checkout@v3 @@ -52,11 +45,6 @@ jobs: ref: main path: folder-overview - - name: Ensure we are on main branch - run: | - cd folder-overview - git checkout main || git checkout -b main - - name: Copy built files to folder-overview run: | cp folder-notes/src/obsidian-folder-overview/main.js \ @@ -74,29 +62,3 @@ jobs: git commit -m "Add built files for release" git push origin main fi - - - name: Trigger release workflow in folder-overview - run: | - curl -X POST -H "Authorization: token ${{ secrets.PAT }}" \ - -H "Accept: application/vnd.github.v3+json" \ - https://api.github.com/repos/LostPaul/obsidian-folder-overview/actions/workflows/release.yaml/dispatches \ - -d '{"ref": "main", "inputs": {"tag": "${{ github.ref_name }}"}}' - - cleanup: - needs: build-and-push - runs-on: ubuntu-latest - steps: - - name: Checkout folder-overview for cleanup - uses: actions/checkout@v3 - with: - repository: LostPaul/obsidian-folder-overview - token: ${{ secrets.PAT }} - ref: main - path: folder-overview - - - name: Remove built files after release - run: | - cd folder-overview - git rm -f main.js styles.css || true - git commit -m "Cleanup built files after release" || echo "No changes to commit" - git push origin main || echo "No changes to push" From 7903068cc609358855d351edaef0f32432d330fd Mon Sep 17 00:00:00 2001 From: Lost Paul <70213368+LostPaul@users.noreply.github.com> Date: Mon, 24 Feb 2025 08:23:28 +0100 Subject: [PATCH 3/5] Update and rename create-release-for-fv.yaml to build-and-push.yml --- ...release-for-fv.yaml => build-and-push.yml} | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) rename .github/workflows/{create-release-for-fv.yaml => build-and-push.yml} (67%) diff --git a/.github/workflows/create-release-for-fv.yaml b/.github/workflows/build-and-push.yml similarity index 67% rename from .github/workflows/create-release-for-fv.yaml rename to .github/workflows/build-and-push.yml index 2ae4ae9..d908f83 100644 --- a/.github/workflows/create-release-for-fv.yaml +++ b/.github/workflows/build-and-push.yml @@ -1,9 +1,6 @@ name: Build and Push to Folder Overview on: - push: - tags: - - "[0-9]+.[0-9]+.[0-9]+" workflow_dispatch: inputs: tag: @@ -17,25 +14,17 @@ jobs: - name: Checkout folder-notes uses: actions/checkout@v3 with: - repository: LostPaul/obsidian-folder-notes fetch-depth: 0 - submodules: recursive - path: folder-notes - name: Install dependencies - run: | - cd folder-notes - npm install + run: npm install - name: Build folder-overview - run: | - cd folder-notes - npm run fv-build # This will run esbuild.config.mjs + run: npm run fv-build - name: Verify build output run: | - ls -la folder-notes/src/obsidian-folder-overview/ - ls -la folder-notes/dist/ + ls -la src/obsidian-folder-overview/ - name: Checkout folder-overview uses: actions/checkout@v3 @@ -47,8 +36,8 @@ jobs: - name: Copy built files to folder-overview run: | - cp folder-notes/src/obsidian-folder-overview/main.js \ - folder-notes/src/obsidian-folder-overview/styles.css folder-overview/ + cp src/obsidian-folder-overview/main.js \ + src/obsidian-folder-overview/styles.css folder-overview/ - name: Commit and push built files run: | @@ -62,3 +51,10 @@ jobs: git commit -m "Add built files for release" git push origin main fi + + - name: Trigger release on folder-overview + run: | + curl -X POST -H "Authorization: token ${{ secrets.PAT }}" \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/repos/LostPaul/obsidian-folder-overview/actions/workflows/release.yml/dispatches \ + -d '{"ref": "main", "inputs": {"tag": "${{ github.event.inputs.tag }}"}}' From d5179f5780e3a35507ca3990436cb20d43ac55f4 Mon Sep 17 00:00:00 2001 From: Lost Paul <70213368+LostPaul@users.noreply.github.com> Date: Mon, 24 Feb 2025 08:37:47 +0100 Subject: [PATCH 4/5] Update build-and-push.yml --- .github/workflows/build-and-push.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index d908f83..a67cd67 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -14,6 +14,7 @@ jobs: - name: Checkout folder-notes uses: actions/checkout@v3 with: + submodules: recursive fetch-depth: 0 - name: Install dependencies From 029bf36dbfd91ff7fe0578cc40970244abf0f90b Mon Sep 17 00:00:00 2001 From: Lost Paul <70213368+LostPaul@users.noreply.github.com> Date: Mon, 24 Feb 2025 09:08:37 +0100 Subject: [PATCH 5/5] Update build-and-push.yml --- .github/workflows/build-and-push.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index a67cd67..b30b2a2 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -14,9 +14,14 @@ jobs: - name: Checkout folder-notes uses: actions/checkout@v3 with: - submodules: recursive + submodules: false fetch-depth: 0 + - name: Update submodules manually + run: | + git submodule sync + git submodule update --init --recursive --remote + - name: Install dependencies run: npm install