Self-hosted email delivery platform that enables applications to send emails via HTTP APIs while handling SMTP delivery, templates, storage, security, and analytics. Fully self-hostable alternative to services like SendGrid or Mailgun.
Go email-relayemail-routinghttp-to-smtpmail-deliverymailchimp-alternativemailgun-alternativemailsendermailservermailtemplatemailtestpostmark-alternativesend-emailsendgrid-alternativesendmailtransactional-emailtransactional-outbox
ci: publish a nightly image from the nightly branch
Jonas Kaninda5c9d068af10d
diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.ymlnew file mode 100644index 0000000..38b7fe2--- /dev/null+++ b/.github/workflows/nightly.yml@@ -0,0 +1,128 @@+name: Nightly++on:+ push:+ branches: [nightly]+ workflow_dispatch:++permissions:+ contents: read++# Only the newest push matters when the tag is rolling — cancel a build that a+# later commit has already superseded.+concurrency:+ group: nightly+ cancel-in-progress: true++jobs:+ backend:+ name: Backend+ runs-on: ubuntu-latest+ services:+ postgres:+ image: postgres:17-alpine+ env:+ POSTGRES_USER: posta+ POSTGRES_PASSWORD: posta+ POSTGRES_DB: posta+ ports: ['5432:5432']+ options: >-+ --health-cmd pg_isready+ --health-interval 10s+ --health-timeout 5s+ --health-retries 5+ redis:+ image: redis:7-alpine+ ports: ['6379:6379']+ options: >-+ --health-cmd "redis-cli ping"+ --health-interval 10s+ --health-timeout 5s+ --health-retries 5+ steps:+ - uses: actions/checkout@v7+ - uses: actions/setup-go@v7+ with:+ go-version-file: go.mod+ - run: go vet ./...+ - run: go test ./...+ env:+ TEST_DATABASE_DSN: host=localhost user=posta password=posta dbname=posta port=5432 sslmode=disable++ frontend:+ name: Frontend+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@v7+ - uses: actions/setup-node@v7+ with:+ node-version: '24'+ cache: 'npm'+ cache-dependency-path: web/package-lock.json+ - run: npm ci+ working-directory: web+ - run: npm run type-check+ working-directory: web++ image:+ name: Image+ needs: [backend, frontend]+ runs-on: ubuntu-latest+ steps:+ # Full history and tags, so the newest release tag can be found.+ - uses: actions/checkout@v7+ with:+ fetch-depth: 0++ - name: Set version+ run: |+ set -euo pipefail+ LATEST="$(git -c versionsort.suffix=-rc tag --list 'v*' --sort=-v:refname | head -1)"+ if [ -z "$LATEST" ]; then+ echo "::error::no v* release tag found to base the nightly version on"+ exit 1+ fi+ {+ echo "VERSION=${LATEST#v}-$(date -u +%Y%m%d)-g${GITHUB_SHA::7}"+ echo "BUILD_TIME=$(date -u +%Y-%m-%dT%H:%M:%SZ)"+ } >> "$GITHUB_ENV"++ - uses: docker/setup-qemu-action@v4+ - uses: docker/setup-buildx-action@v4++ - name: Log in to Docker Hub+ uses: docker/login-action@v4+ with:+ username: ${{ secrets.DOCKERHUB_USERNAME }}+ password: ${{ secrets.DOCKERHUB_TOKEN }}++ - name: Build and push+ uses: docker/build-push-action@v7+ with:+ context: .+ file: ./docker/Dockerfile+ platforms: linux/amd64,linux/arm64+ push: true+ build-args: |+ VERSION=${{ env.VERSION }}+ BUILD_DATE=${{ env.BUILD_TIME }}+ COMMIT=${{ github.sha }}+ tags: |+ ${{ vars.BUILDKIT_IMAGE }}:nightly+ cache-from: type=gha+ cache-to: type=gha,mode=max++ - name: Summary+ run: |+ {+ echo "### Nightly published"+ echo+ echo "| Image | Tag |"+ echo "|---|---|"+ echo "| \`${{ vars.BUILDKIT_IMAGE }}\` | \`nightly\` |"+ echo+ echo "Built from \`${GITHUB_SHA::7}\`, reported as \`${VERSION}\`."+ echo+ echo "The tag is rolling: \`docker pull\` again to move forward, and pin a"+ echo "released version instead if you need the same bits twice."+ } >> "$GITHUB_STEP_SUMMARY"diff --git a/internal/services/messages/validate_test.go b/internal/services/messages/validate_test.goindex aa4d225..3fd479f 100644--- a/internal/services/messages/validate_test.go+++ b/internal/services/messages/validate_test.go@@ -73,8 +73,8 @@ func TestValidateAcceptsAndCoerces(t *testing.T) {if !reflect.DeepEqual(got.Data, want) {t.Errorf("data:\n got %#v\nwant %#v", got.Data, want)}- display := map[string]string{}- keys := []string{}+ display := make(map[string]string, len(got.Fields))+ keys := make([]string, 0, len(got.Fields))for _, f := range got.Fields {display[f.Key] = f.Valuekeys = append(keys, f.Key)@@ -140,7 +140,7 @@ func TestValidateUnknownFields(t *testing.T) {}submitted := fieldsOf("email", "[email protected]", "old", "legacy", "extra", "x")keys := func(fs []models.MessageField) string {- var k []string+ k := make([]string, 0, len(fs))for _, f := range fs {k = append(k, f.Key)}