diff --git a/.github/workflows/deploy-site.yml b/.github/workflows/deploy-site.yml new file mode 100644 index 0000000..5195580 --- /dev/null +++ b/.github/workflows/deploy-site.yml @@ -0,0 +1,68 @@ +name: Deploy main to gh-pages + +on: + push: + branches: [main] + workflow_dispatch: + +permissions: + contents: write + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.3' + bundler-cache: true + + - name: Build Jekyll site + shell: pwsh + env: + JEKYLL_ENV: production + JEKYLL_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Override baseurl so the github-pages gem does not inject the + # repository name as the baseurl, which would break asset paths. + @" + url: "https://blog.matthewpersico.com" + baseurl: "" + "@ | Set-Content -Path /tmp/_config_deploy.yml + + bundle exec jekyll build --config _config.yml,/tmp/_config_deploy.yml + + # Preserve any PR preview directories that already live on gh-pages so + # that a main-site redeploy does not wipe them out. + - name: Restore previews directories from gh-pages branch (if present) + shell: pwsh + run: | + git ls-remote --exit-code --heads origin gh-pages *> $null + if ($LASTEXITCODE -ne 0) { + Write-Host "gh-pages branch does not exist yet - skipping restore." + exit 0 + } + + git fetch origin gh-pages --depth=1 + + # Copy the previews tree into the freshly built _site so the + # subsequent deploy action includes it in the push. + git checkout origin/gh-pages -- previews/ 2>$null + if ($LASTEXITCODE -eq 0) { + Copy-Item -Recurse -Force previews _site/previews + Remove-Item -Recurse -Force previews + } + else { + Write-Host "No previews directory on gh-pages yet - skipping restore." + exit 0 + } + + - name: Deploy to gh-pages branch + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./_site + cname: blog.matthewpersico.com + commit_message: "Deploy main site from ${{ github.sha }}" \ No newline at end of file diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml new file mode 100644 index 0000000..a42016a --- /dev/null +++ b/.github/workflows/pr-preview.yml @@ -0,0 +1,116 @@ +name: Deploy PR preview to gh-pages + +on: + pull_request: + types: [opened, synchronize, reopened, closed] + +permissions: + contents: write + pull-requests: write + +jobs: + deploy-preview: + if: github.event.action != 'closed' + runs-on: ubuntu-latest + concurrency: + group: pr-preview-deploy-${{ github.event.pull_request.number }} + cancel-in-progress: true + steps: + - uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.3' + bundler-cache: true + + - name: Build Jekyll preview site + shell: pwsh + env: + JEKYLL_ENV: production + JEKYLL_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Override baseurl for the preview path + @" + url: "https://blog.matthewpersico.com" + baseurl: "/previews/pr-${{ github.event.pull_request.number }}" + "@ | Set-Content -Path /tmp/_config_preview.yml + + bundle exec jekyll build --config _config.yml,/tmp/_config_preview.yml --destination ./_site_preview + + - name: Deploy preview to gh-pages branch previews subdirectory + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./_site_preview + destination_dir: previews/pr-${{ github.event.pull_request.number }} + keep_files: true + commit_message: "Deploy preview for PR #${{ github.event.pull_request.number }} (${{ github.sha }})" + + - name: Post / Update preview URL comment on PR + uses: actions/github-script@v7 + with: + script: | + const prNumber = context.payload.pull_request.number; + const previewUrl = `https://blog.matthewpersico.com/previews/pr-${prNumber}/`; + const marker = ''; + const body = + `${marker}\n` + + `🔍 **PR Preview deployed:** ${previewUrl}\n\n` + + `_This preview is updated on every commit and will be removed when the PR is closed._`; + + const { data: comments } = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + }); + + const existing = comments.find(c => c.body.includes(marker)); + if (existing) { + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: existing.id, + body, + }); + } else { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + body, + }); + } + + cleanup-preview: + if: github.event.action == 'closed' + runs-on: ubuntu-latest + concurrency: + group: pr-preview-cleanup-${{ github.event.pull_request.number }} + cancel-in-progress: false + steps: + - uses: actions/checkout@v4 + + - name: Remove preview directory from gh-pages branch + shell: pwsh + run: | + git ls-remote --exit-code --heads origin gh-pages *> $null + if ($LASTEXITCODE -ne 0) { + Write-Host "gh-pages branch does not exist - nothing to clean up." + exit 0 + } + + git fetch origin gh-pages:gh-pages --depth=1 + git checkout gh-pages + + $prDir = "previews/pr-${{ github.event.pull_request.number }}" + if (Test-Path $prDir) { + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git rm -r -f $prDir + git commit -m "Remove preview for PR #${{ github.event.pull_request.number }}" + git push --set-upstream origin gh-pages + } + else { + Write-Host "Preview directory '$prDir' not found - nothing to clean up." + exit 0 + } diff --git a/_config.yaml b/_config.yml similarity index 83% rename from _config.yaml rename to _config.yml index ee7483c..b9c987b 100644 --- a/_config.yaml +++ b/_config.yml @@ -24,4 +24,6 @@ plugins: - jekyll-feed - jekyll-sitemap - jekyll-seo-tag - - jekyll-remote-theme \ No newline at end of file + - jekyll-remote-theme + +repository: matthewpersico/matthewpersico.github.io diff --git a/_posts/2026-05-16-brave-browser.md b/_posts/2026-05-16-brave-browser.md index c3c2813..5b70532 100644 --- a/_posts/2026-05-16-brave-browser.md +++ b/_posts/2026-05-16-brave-browser.md @@ -40,7 +40,13 @@ Chrome uses Google infrastructure (log in with your Google credentials) and Edge There is an explicit "Sync" section in the Brave Settings. On the first platform where you install Brave, you establish a new 'sync chain' and pick which pieces of data to sync with other platforms. -On subsequent platforms, you go to the same "sync" section, but chose to connect to an existing sync chain. On your original platform you chose to View Sync Code. It can be either a  that your phone or camera can scan to sync up or you can use a string of  to enter on your new computer to allow permissions to sync. +On subsequent platforms, you go to the same "sync" section, but chose to connect to an existing sync chain. On your original platform you chose to View Sync Code. It can be either a QR code that your phone or camera can scan to sync up: + + + +or you can use a string of 25 words to enter on your new computer to allow permissions to sync: + + Figure 1 shows my sync device list: diff --git a/blog.html b/blog.html index e2f89ce..4fa5a40 100644 --- a/blog.html +++ b/blog.html @@ -6,7 +6,7 @@
{{ topic.content | markdownify }}