Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/deploy-site.yml
Original file line number Diff line number Diff line change
@@ -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 }}"
116 changes: 116 additions & 0 deletions .github/workflows/pr-preview.yml
Original file line number Diff line number Diff line change
@@ -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
}
4 changes: 3 additions & 1 deletion _config.yaml → _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ plugins:
- jekyll-feed
- jekyll-sitemap
- jekyll-seo-tag
- jekyll-remote-theme
- jekyll-remote-theme

repository: matthewpersico/matthewpersico.github.io
8 changes: 7 additions & 1 deletion _posts/2026-05-16-brave-browser.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 ![QR code]({{"/assets/images/2026-05-16-brave-browser/qr.jpg" | relative_url }}) that your phone or camera can scan to sync up or you can use a string of ![25 words]({{"/assets/images/2026-05-16-brave-browser/text.jpg" | relative_url }}) 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:

![QR code]({{"/assets/images/2026-05-16-brave-browser/qr.jpg" | relative_url }})

or you can use a string of 25 words to enter on your new computer to allow permissions to sync:

![25 words]({{"/assets/images/2026-05-16-brave-browser/text.jpg" | relative_url }})

Figure 1 shows my sync device list:

Expand Down
2 changes: 1 addition & 1 deletion blog.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ <h1>Latest Posts</h1>
<ul>
{% for post in site.posts %}
<li>
<h2><a href="{{ post.url }}">{{ post.title }}</a></h2>
<h2><a href="{{ post.url | relative_url }}">{{ post.title }}</a></h2>
{{ post.excerpt }}
</li>
{% endfor %}
Expand Down
2 changes: 1 addition & 1 deletion topics.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ <h1>Topics</h1>
<ul>
{% for topic in site.topics %}
<li>
<h2><a href="{{ topic.url }}">{{ topic.name }}</a></h2>
<h2><a href="{{ topic.url | relative_url }}">{{ topic.name }}</a></h2>
<p>{{ topic.content | markdownify }}</p>
</li>
{% endfor %}
Expand Down
Loading