Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/deploy-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
validate:
name: Validate sources job
needs: [ assert-ref ]
uses: ptr727/ProjectTemplate/.github/workflows/validate-task.yml@1801ee7ee76193ed4393fbd85a5cd85e74446565 # 2.0.707
uses: ptr727/ProjectTemplate/.github/workflows/validate-task.yml@904096552cea4192d7a1c4db88a347fbb18272e9 # 2.0.718
permissions:
contents: read
with:
Expand All @@ -52,7 +52,7 @@ jobs:
deploy:
name: Deploy site job
needs: [ validate ]
uses: ptr727/ProjectTemplate/.github/workflows/deploy-site-task.yml@1801ee7ee76193ed4393fbd85a5cd85e74446565 # 2.0.707
uses: ptr727/ProjectTemplate/.github/workflows/deploy-site-task.yml@904096552cea4192d7a1c4db88a347fbb18272e9 # 2.0.718
with:
environment: ${{ inputs.environment }}
permissions:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/merge-bot-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

merge-bot:
name: Merge bot pull request job
uses: ptr727/ProjectTemplate/.github/workflows/merge-bot-task.yml@1801ee7ee76193ed4393fbd85a5cd85e74446565 # 2.0.707
uses: ptr727/ProjectTemplate/.github/workflows/merge-bot-task.yml@904096552cea4192d7a1c4db88a347fbb18272e9 # 2.0.718
secrets:
CODEGEN_APP_CLIENT_ID: ${{ secrets.CODEGEN_APP_CLIENT_ID }}
CODEGEN_APP_PRIVATE_KEY: ${{ secrets.CODEGEN_APP_PRIVATE_KEY }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
# Also replaces this repo's own dispatch-ref assertion: the hub task errors identically on a ref other than main/develop.
plan:
name: Plan release job
uses: ptr727/ProjectTemplate/.github/workflows/publish-plan-task.yml@1801ee7ee76193ed4393fbd85a5cd85e74446565 # 2.0.707
uses: ptr727/ProjectTemplate/.github/workflows/publish-plan-task.yml@904096552cea4192d7a1c4db88a347fbb18272e9 # 2.0.718
with:
event_name: ${{ github.event_name }}
actor: ${{ github.actor }}
Expand All @@ -31,7 +31,7 @@ jobs:
name: Validate sources job
needs: [plan]
if: ${{ needs.plan.outputs.publish == 'true' }}
uses: ptr727/ProjectTemplate/.github/workflows/validate-task.yml@1801ee7ee76193ed4393fbd85a5cd85e74446565 # 2.0.707
uses: ptr727/ProjectTemplate/.github/workflows/validate-task.yml@904096552cea4192d7a1c4db88a347fbb18272e9 # 2.0.718
permissions:
contents: read
with:
Expand All @@ -49,7 +49,7 @@ jobs:
# An if: on a job replaces the implicit success() over its needs.
# Without the validate arm a failed gate would publish anyway.
if: ${{ needs.plan.outputs.publish == 'true' && needs.validate.result == 'success' }}
uses: ptr727/ProjectTemplate/.github/workflows/build-release-task.yml@1801ee7ee76193ed4393fbd85a5cd85e74446565 # 2.0.707
uses: ptr727/ProjectTemplate/.github/workflows/build-release-task.yml@904096552cea4192d7a1c4db88a347fbb18272e9 # 2.0.718
permissions:
contents: write
actions: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

validate:
name: Validate sources job
uses: ptr727/ProjectTemplate/.github/workflows/validate-task.yml@1801ee7ee76193ed4393fbd85a5cd85e74446565 # 2.0.707
uses: ptr727/ProjectTemplate/.github/workflows/validate-task.yml@904096552cea4192d7a1c4db88a347fbb18272e9 # 2.0.718
Comment thread
ptr727 marked this conversation as resolved.
Resolved
permissions:
contents: read
with:
Expand Down
12 changes: 6 additions & 6 deletions .secrets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ exposing one.
The documented local convention is `~/.secrets/`, not this directory. CI supplies the same
values directly from the GitHub Environment instead, reading no file here at all.
`ENV_FILE=<name> deploy/make-release.sh` resolves a relative `ENV_FILE` against `$HOME/.secrets`,
refuses a traversing one, and defaults to `~/.secrets/Blog.local.production.env`. An absolute
refuses a traversing one, and defaults to `~/.secrets/blog.local.production.env`. An absolute
`ENV_FILE` is honored as given rather than resolved against `~/.secrets/`, an escape hatch rather
than the documented shape.
`~/.secrets/` is shared across every repo on the host, so each of this repo's files carries the
`Blog.` prefix:
`blog.` prefix:

| File | Selects |
| --- | --- |
| `~/.secrets/Blog.local.production.env` | The default, read when `ENV_FILE` is unset. |
| `~/.secrets/Blog.local.staging.env` | The local staging mirror. |
| `~/.secrets/Blog.vps.production.env` | The VPS production environment. |
| `~/.secrets/Blog.vps.staging.env` | The VPS staging environment. |
| `~/.secrets/blog.local.production.env` | The default, read when `ENV_FILE` is unset. |
| `~/.secrets/blog.local.staging.env` | The local staging mirror. |
| `~/.secrets/blog.vps.production.env` | The VPS production environment. |
| `~/.secrets/blog.vps.staging.env` | The VPS staging environment. |

Every value each file holds, and what reads it, is described once in
[`ENVIRONMENT.md`](../ENVIRONMENT.md). Start a new one from [`example.env`](./example.env).
12 changes: 6 additions & 6 deletions .secrets/example.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This file states the shape and a placeholder. Add a value here and describe it there,
# or checks/check-env-docs.py fails.
#
# One destination: ~/.secrets/Blog.<server>.<environment>.env on a workstation, one file
# One destination: ~/.secrets/blog.<server>.<environment>.env on a workstation, one file
# per environment. The off-host VPS backup pull, and the environment file it reads, are
# maintained outside this repository -- see OPERATIONS.md, Working With the VPS.
#
Expand All @@ -15,14 +15,14 @@
# HUGO_BASEURL for Hugo, only where that tool requires its own name.

# =============================================================================
# ~/.secrets/Blog.<server>.<environment>.env
# ~/.secrets/blog.<server>.<environment>.env
# =============================================================================
# One file per environment, named for the server it describes and the environment on it,
# with both words spelled out, and selected by ENV_FILE:
# Blog.local.production.env the default, read when ENV_FILE is unset
# Blog.local.staging.env ENV_FILE=Blog.local.staging.env deploy/make-release.sh
# Blog.vps.production.env ENV_FILE=Blog.vps.production.env deploy/make-release.sh
# Blog.vps.staging.env ENV_FILE=Blog.vps.staging.env deploy/make-release.sh
# blog.local.production.env the default, read when ENV_FILE is unset
# blog.local.staging.env ENV_FILE=blog.local.staging.env deploy/make-release.sh
# blog.vps.production.env ENV_FILE=blog.vps.production.env deploy/make-release.sh
# blog.vps.staging.env ENV_FILE=blog.vps.staging.env deploy/make-release.sh
#
# Sourced with `set -a`, which overwrites a variable the caller exported first. A named
# file that does not exist is a hard failure rather than a fall-through. Real files live
Expand Down
8 changes: 4 additions & 4 deletions ENVIRONMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ Every configuration value this repository reads or writes, described once. [`OPE

## The mechanism

A local run reads one file. `~/.secrets/Blog.<server>.<environment>.env` is sourced with `set -a`, selected by `ENV_FILE`, and defaults to `~/.secrets/Blog.local.production.env`. The real files live on the host, never in this checkout, and [`.secrets/example.env`](./.secrets/example.env) is the tracked template that documents the shape.
A local run reads one file. `~/.secrets/blog.<server>.<environment>.env` is sourced with `set -a`, selected by `ENV_FILE`, and defaults to `~/.secrets/blog.local.production.env`. The real files live on the host, never in this checkout, and [`.secrets/example.env`](./.secrets/example.env) is the tracked template that documents the shape.

Two consequences of `set -a` are worth stating because both have surprised someone. Sourcing overwrites a variable the caller exported first, so exporting `DEPLOY_ROOT` by hand does not switch environments and only `ENV_FILE` does. And a named file that does not exist is a hard failure rather than a fall-through, because on a host serving two sites the ambient value is the other site's root.

CI reads no file. The deploy workflow resolves the same values from the GitHub Environment, which is why the shapes have to match even though the sources do not.

## Repository environment files

Held in `~/.secrets/Blog.<server>.<environment>.env`, one file per environment, on the host rather than in this checkout. Template: [`.secrets/example.env`](./.secrets/example.env).
Held in `~/.secrets/blog.<server>.<environment>.env`, one file per environment, on the host rather than in this checkout. Template: [`.secrets/example.env`](./.secrets/example.env).

| Value | Names | Notes |
| --- | --- | --- |
Expand Down Expand Up @@ -64,7 +64,7 @@ Every variable and secret this repository stores for GitHub Actions, Dependabot,

**The family values reach no deploy step.** The deploy workflow's verify step receives `SITE_BASE_URL` and the blog's token pair from the hub's deploy task, and no family variable. A deploy therefore does not check the family host, and the family check runs from a local environment file.

**`SITE_BASE_URL` being read twice is the trap worth knowing.** A wrong value bakes the wrong address into every canonical tag and then runs the full URL contract against that same wrong address, so the deploy verifies itself and passes. Its generic name is the hub's own `deploy-site-task.yml` interface, and it is also the one this repository's own scripts and `~/.secrets/Blog.*.env` files read: `make-release.sh` bridges it to Hugo's own `HUGO_BASEURL` in one place, since only Hugo requires that name.
**`SITE_BASE_URL` being read twice is the trap worth knowing.** A wrong value bakes the wrong address into every canonical tag and then runs the full URL contract against that same wrong address, so the deploy verifies itself and passes. Its generic name is the hub's own `deploy-site-task.yml` interface, and it is also the one this repository's own scripts and `~/.secrets/blog.*.env` files read: `make-release.sh` bridges it to Hugo's own `HUGO_BASEURL` in one place, since only Hugo requires that name.

**A host rebuild regenerates the SSH host keys and the pinned value stops matching**, which fails every deploy closed and blocks the rollback path at the same moment a rebuild makes both matter. Replace `DEPLOY_SSH_KNOWN_HOSTS` on **both** environments before the first deploy after a rebuild.

Expand All @@ -74,7 +74,7 @@ Set on the command line for one run rather than stored anywhere.

| Value | Effect |
| --- | --- |
| `ENV_FILE` | which environment file to source. Defaults to `~/.secrets/Blog.local.production.env` |
| `ENV_FILE` | which environment file to source. Defaults to `~/.secrets/blog.local.production.env` |
| `REQUIRE_BROTLI=1` | fail rather than shipping gzip-only. CI sets it |
| `NO_LINK_DEST=1` | full copy instead of hard-linking from the previous release |
| `KEEP_RELEASES` | how many releases `make-release.sh` leaves behind |
Expand Down
Loading
Loading