diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6e960e14..829c1da1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -102,21 +102,25 @@ jobs: - name: Build assets run: mix assets.setup && mix assets.deploy - # The release image for ops/compose.yml, only for main and only when the - # other jobs pass. Watchtower on the server pulls :latest at night. + # The release image for ops/compose.yml; Watchtower on the server pulls :latest + # at night. Only main writes the layer cache, so pull requests do not evict it. image: needs: [test, assets] - if: github.event_name == 'push' && github.ref == 'refs/heads/main' runs-on: ubuntu-24.04 + # One build per ref at a time, so an older build cannot push :latest over a newer one. + concurrency: image-${{ github.ref }} permissions: contents: read packages: write + env: + PUBLISH: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} steps: - uses: actions/checkout@v7 - uses: docker/setup-buildx-action@v4 - - uses: docker/login-action@v4 + - if: env.PUBLISH == 'true' + uses: docker/login-action@v4 with: registry: ghcr.io username: ${{ github.actor }} @@ -134,8 +138,8 @@ jobs: with: context: . platforms: linux/amd64 - push: true + push: ${{ env.PUBLISH == 'true' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha - cache-to: type=gha,mode=max + cache-to: ${{ env.PUBLISH == 'true' && 'type=gha,mode=max' || '' }} diff --git a/Dockerfile b/Dockerfile index 5bd6be77..a293eb46 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,8 @@ # syntax=docker/dockerfile:1 # -# Release image of the CMS. CI builds it on main and pushes it to -# ghcr.io/feather-page/cms; it runs with docker compose (ops/compose.yml). +# Release image of the CMS. CI builds it for pull requests and main, and pushes +# it from main to ghcr.io/feather-page/cms; it runs with docker compose +# (ops/compose.yml). # # Volume: /data (SQLite database, image storage and build output). # The container migrates the database on start (bin/server). diff --git a/lib/feather/fediverse/mention.ex b/lib/feather/fediverse/mention.ex index 12524ed5..d1d7af61 100644 --- a/lib/feather/fediverse/mention.ex +++ b/lib/feather/fediverse/mention.ex @@ -34,7 +34,13 @@ defmodule Feather.Fediverse.Mention do field :visibility, Ecto.Enum, values: [:public, :followers, :direct] field :content, Feather.Encrypted.Binary, redact: true field :summary, Feather.Encrypted.Binary, redact: true - field :attachments, Feather.Encrypted.List, default: [], redact: true + + # No default dump at compile time: that needs the key, which a release reads at runtime. + field :attachments, Feather.Encrypted.List, + default: [], + skip_default_validation: true, + redact: true + field :named_accounts, {:array, :string}, default: [] field :published_at, :utc_datetime_usec field :read_at, :utc_datetime_usec diff --git a/lib/feather/fediverse/timeline_post.ex b/lib/feather/fediverse/timeline_post.ex index a83365f2..f93a8e25 100644 --- a/lib/feather/fediverse/timeline_post.ex +++ b/lib/feather/fediverse/timeline_post.ex @@ -25,7 +25,13 @@ defmodule Feather.Fediverse.TimelinePost do field :name, Feather.Encrypted.Binary, redact: true field :content, Feather.Encrypted.Binary, redact: true field :summary, Feather.Encrypted.Binary, redact: true - field :attachments, Feather.Encrypted.List, default: [], redact: true + + # No default dump at compile time: that needs the key, which a release reads at runtime. + field :attachments, Feather.Encrypted.List, + default: [], + skip_default_validation: true, + redact: true + field :named_accounts, {:array, :string}, default: [] field :published_at, :utc_datetime_usec