commit ea038ce39c7995e5789f2ed8abc9a0d08aedde72 Author: will Date: Mon Jul 20 18:28:38 2026 +0000 Initial commit diff --git a/.gitea/workflows/send.yml b/.gitea/workflows/send.yml new file mode 100644 index 0000000..7da6a8c --- /dev/null +++ b/.gitea/workflows/send.yml @@ -0,0 +1,48 @@ +name: Send campaign +on: + # Pushing a tag like send/big-announcement is the primary trigger — a + # deliberate, git-native, auditable action (git log --tags shows every + # real send that ever happened). These are "command tags," not release + # tags: fine to delete and re-push if a send needs retrying, since the + # actual safety net is listmonk's own draft/paused status check in + # `eec-campaigns send`, not tag uniqueness. + push: + tags: ["send/*"] + # workflow_dispatch is kept alongside it for when clicking a button is + # more convenient than a local `git tag && git push`. Same command either + # way. + workflow_dispatch: + inputs: + slug: + description: "Campaign slug (campaigns//) to send" + required: true + type: string + +jobs: + send: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version: "1.23.1" + + - name: Install eec-campaigns + run: go install gitea.reground.org/will/eec-campaigns@v0.1.0 + + - name: Determine campaign slug + id: slug + run: | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + echo "value=${{ inputs.slug }}" >> "$GITHUB_OUTPUT" + else + echo "value=${GITHUB_REF#refs/tags/send/}" >> "$GITHUB_OUTPUT" + fi + + - name: Send campaign + run: eec-campaigns send "${{ steps.slug.outputs.value }}" + env: + LISTMONK_BASE_URL: ${{ secrets.CAMPAIGNS_LISTMONK_BASE_URL }} + LISTMONK_API_USER: ${{ secrets.CAMPAIGNS_LISTMONK_API_USER }} + LISTMONK_API_TOKEN: ${{ secrets.CAMPAIGNS_LISTMONK_API_TOKEN }} diff --git a/.gitea/workflows/sync-template.yml b/.gitea/workflows/sync-template.yml new file mode 100644 index 0000000..2381b7f --- /dev/null +++ b/.gitea/workflows/sync-template.yml @@ -0,0 +1,25 @@ +name: Sync default campaign template +on: + workflow_dispatch: {} + +jobs: + sync-template: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version: "1.23.1" + + - name: Install eec-campaigns + run: go install gitea.reground.org/will/eec-campaigns@v0.1.0 + + # TODO: rename "TEMPLATE default" below to " default" + # (or any name you like) as part of customizing this template. + - name: Sync template to listmonk + run: eec-campaigns template "TEMPLATE default" email-templates/campaign.html + env: + LISTMONK_BASE_URL: ${{ secrets.CAMPAIGNS_LISTMONK_BASE_URL }} + LISTMONK_API_USER: ${{ secrets.CAMPAIGNS_LISTMONK_API_USER }} + LISTMONK_API_TOKEN: ${{ secrets.CAMPAIGNS_LISTMONK_API_TOKEN }} diff --git a/.gitea/workflows/sync.yml b/.gitea/workflows/sync.yml new file mode 100644 index 0000000..3f26c9d --- /dev/null +++ b/.gitea/workflows/sync.yml @@ -0,0 +1,25 @@ +name: Sync campaigns +on: + push: + branches: [master] + +jobs: + sync: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version: "1.23.1" + + - name: Install eec-campaigns + run: go install gitea.reground.org/will/eec-campaigns@v0.1.0 + + - name: Sync campaigns to listmonk + run: eec-campaigns sync . + env: + LISTMONK_BASE_URL: ${{ secrets.CAMPAIGNS_LISTMONK_BASE_URL }} + LISTMONK_API_USER: ${{ secrets.CAMPAIGNS_LISTMONK_API_USER }} + LISTMONK_API_TOKEN: ${{ secrets.CAMPAIGNS_LISTMONK_API_TOKEN }} + CAMPAIGNS_PREVIEW_EMAIL: ${{ secrets.CAMPAIGNS_PREVIEW_EMAIL }} diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml new file mode 100644 index 0000000..00d1208 --- /dev/null +++ b/.gitea/workflows/test.yml @@ -0,0 +1,32 @@ +name: Test-send campaign +on: + workflow_dispatch: + inputs: + slug: + description: "Campaign slug (campaigns//) to preview" + required: true + type: string + email: + description: "Address to send the preview to" + required: true + type: string + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version: "1.23.1" + + - name: Install eec-campaigns + run: go install gitea.reground.org/will/eec-campaigns@v0.1.0 + + - name: Send preview + run: eec-campaigns test "${{ inputs.slug }}" "${{ inputs.email }}" + env: + LISTMONK_BASE_URL: ${{ secrets.CAMPAIGNS_LISTMONK_BASE_URL }} + LISTMONK_API_USER: ${{ secrets.CAMPAIGNS_LISTMONK_API_USER }} + LISTMONK_API_TOKEN: ${{ secrets.CAMPAIGNS_LISTMONK_API_TOKEN }} diff --git a/README.md b/README.md new file mode 100644 index 0000000..e003318 --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +# campaigns-template + +Gitea template repo for standing up a new domain/client's campaign content repo. Generate a new repo from this one (Gitea → this repo → "Generate Repo," or `POST /api/v1/repos/generate/will/campaigns-template`) rather than cloning it — generating starts the new repo with a clean history of its own. + +Full reference for everything below lives in the [`eec-campaigns` README](https://gitea.reground.org/will/eec-campaigns). + +## After generating a new repo from this template + +1. **Rename the template.** In `.gitea/workflows/sync-template.yml`, replace `TEMPLATE default` with a name specific to this domain (e.g. ` default`). +2. **Restyle `email-templates/campaign.html`** if this client wants different branding than the stock listmonk template it starts as. +3. **Add repo secrets** (Gitea Actions → Secrets): `CAMPAIGNS_LISTMONK_BASE_URL`, `CAMPAIGNS_LISTMONK_API_USER`, `CAMPAIGNS_LISTMONK_API_TOKEN`, and optionally `CAMPAIGNS_PREVIEW_EMAIL` — scoped to this domain's own listmonk instance and its own dedicated API user (see `reground-infrastructure`'s `campaigns` Ansible role for provisioning that user). +4. **Check the tool version pin** in all four `.gitea/workflows/*.yml` files (currently `v0.1.0`) — bump it only deliberately, after confirming a newer `eec-campaigns` release works. +5. Run the `Sync default campaign template` workflow once. +6. Replace this README with a short one for this domain (see `reground-campaigns`'s README for the pattern: a numbered "to send a campaign" list for whoever operates this repo day-to-day). +7. Give the client push/PR access to *this repo only* — that's the entire isolation boundary. They never need access to `eec-campaigns`, `campaigns-template`, or any other domain's repo. + +## Layout + +``` +campaigns/ + / + campaign.md +email-templates/ + campaign.html +.gitea/workflows/ + sync.yml # push to master -> draft + preview + send.yml # tag push send/, or manual dispatch -> real send + test.yml # manual dispatch -> re-preview without touching status + sync-template.yml # manual dispatch -> push email template as listmonk default +``` diff --git a/campaigns/.gitkeep b/campaigns/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/email-templates/campaign.html b/email-templates/campaign.html new file mode 100644 index 0000000..c83add3 --- /dev/null +++ b/email-templates/campaign.html @@ -0,0 +1,115 @@ + + + + + {{ .Campaign.Subject }} + + + + + + +
 
+
+ {{ template "content" . }} +
+ + +
 {{ TrackView }}
+ +