Skip to content

armgit / posta

Public Imported from GitHub
0

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.

ci: update workflows to current action versions

Jonas Kaninda0c0e1aef3976
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 6b9a34c..015b5a7 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -6,6 +6,13 @@ on:
pull_request:
branches: [main, dev]
+permissions:
+ contents: read
+
+concurrency:
+ group: ci-${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
+
jobs:
backend:
runs-on: ubuntu-latest
@@ -31,35 +38,45 @@ jobs:
--health-timeout 5s
--health-retries 5
steps:
- - uses: actions/checkout@v4
- - uses: actions/setup-go@v5
+ - uses: actions/checkout@v7
+ - uses: actions/setup-go@v7
with:
- go-version: '1.26'
+ # Read the version from go.mod so the toolchain has one source of truth.
+ 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
- run: go build -o posta ./cmd/posta
frontend:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v4
- - uses: actions/setup-node@v4
+ - uses: actions/checkout@v7
+ - uses: actions/setup-node@v7
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: web/package-lock.json
- - run: cd web && npm ci && npm run build
+ - run: npm ci
+ working-directory: web
+ - run: npm run type-check
+ working-directory: web
+ - run: npm run build
+ working-directory: web
docker:
needs: [backend, frontend]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v4
- - uses: docker/setup-buildx-action@v3
- - uses: docker/build-push-action@v6
+ - uses: actions/checkout@v7
+ - uses: docker/setup-buildx-action@v4
+ - uses: docker/build-push-action@v7
with:
context: .
- file: "./docker/Dockerfile"
+ file: ./docker/Dockerfile
push: false
tags: posta:latest
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml
index cf6ea3a..a5346f4 100644
--- a/.github/workflows/deploy-docs.yml
+++ b/.github/workflows/deploy-docs.yml
@@ -6,6 +6,7 @@ on:
- main
paths:
- "docs/**"
+ - ".github/workflows/deploy-docs.yml"
workflow_dispatch:
permissions:
@@ -24,11 +25,11 @@ jobs:
run:
working-directory: docs
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v7
- - uses: actions/setup-node@v4
+ - uses: actions/setup-node@v7
with:
- node-version: 24
+ node-version: '24'
cache: npm
cache-dependency-path: docs/package-lock.json
@@ -39,7 +40,7 @@ jobs:
run: npm run build
- name: Upload artifact
- uses: actions/upload-pages-artifact@v3
+ uses: actions/upload-pages-artifact@v5
with:
path: docs/build
@@ -52,4 +53,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
- uses: actions/deploy-pages@v4
+ uses: actions/deploy-pages@v5
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index a7fc8e4..8e4f68c 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -2,22 +2,33 @@ name: Lint
on:
push:
+ branches: [main, dev]
pull_request:
+ branches: [main, dev]
+
+permissions:
+ contents: read
+
+concurrency:
+ group: lint-${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
- lint:
- name: Run on Ubuntu
+ golangci:
+ name: golangci-lint
runs-on: ubuntu-latest
steps:
- name: Clone the code
- uses: actions/checkout@v4
+ uses: actions/checkout@v7
- name: Setup Go
- uses: actions/setup-go@v5
+ uses: actions/setup-go@v7
with:
- go-version: '~1.26'
+ go-version-file: go.mod
- name: Run linter
- uses: golangci/golangci-lint-action@v7
+ uses: golangci/golangci-lint-action@v9
with:
- version: v2.9.0
\ No newline at end of file
+ # Pinned rather than floating: a new linter release must not turn a
+ # green branch red on a day nobody touched the code.
+ version: v2.13.2
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index ef54dbc..ef4544b 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,95 +1,66 @@
name: Release
+
on:
push:
tags:
- - v0.**
+ - 'v*'
+
+permissions:
+ contents: read
+ packages: write
+
+concurrency:
+ group: release-${{ github.ref }}
+ cancel-in-progress: false
+
jobs:
- # Stable releases (v0.11.0): publish the immutable version tag and move
- # :latest. Release candidates are excluded here and handled by docker-rc, so a
- # pre-release never becomes what a bare `docker pull` resolves to.
+ # One job for both channels. A stable tag (v1.2.0) publishes the immutable
+ # version plus :latest; a release candidate (v1.2.0-rc.1) publishes the version
+ # plus :rc, so a pre-release never becomes what a bare `docker pull` resolves
+ # to. Keeping this as one job means the two channels cannot drift apart.
docker:
- if: "!contains(github.ref, '-rc')"
runs-on: ubuntu-latest
- permissions:
- packages: write
- contents: read
steps:
- -
- name: Set up QEMU
- uses: docker/setup-qemu-action@v3
- -
- name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v3
- -
- name: Login to DockerHub
- uses: docker/login-action@v3
- with:
- username: ${{ secrets.DOCKERHUB_USERNAME }}
- password: ${{ secrets.DOCKERHUB_TOKEN }}
- -
- name: Get the tag name
- id: get_tag_name
- run: |
- # Extract tag name and remove "v" if present
- TAG_NAME="${GITHUB_REF#refs/tags/}"
- VERSION="${TAG_NAME#v}"
- echo "VERSION=${VERSION}" >> "$GITHUB_ENV"
- echo "BUILD_TIME=$(date)" >> "$GITHUB_ENV"
- -
- name: Build and push
- uses: docker/build-push-action@v6
- with:
- push: true
- file: "./docker/Dockerfile"
- platforms: linux/amd64,linux/arm64
- build-args: |
- VERSION=${{ env.VERSION }}
- BUILD_DATE=${{ env.BUILD_TIME }}
- COMMIT=${{ github.sha }}
- tags: |
- "${{vars.BUILDKIT_IMAGE}}:${{ env.VERSION }}"
- "${{vars.BUILDKIT_IMAGE}}:latest"
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v4
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v4
- docker-rc:
- if: "contains(github.ref, '-rc')"
- runs-on: ubuntu-latest
- permissions:
- packages: write
- contents: read
- steps:
- -
- name: Set up QEMU
- uses: docker/setup-qemu-action@v3
- -
- name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v3
- -
- name: Login to DockerHub
- uses: docker/login-action@v3
+ - name: Login to DockerHub
+ uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- -
- name: Get the tag name
- id: get_tag_name
+
+ - name: Resolve version and channel
run: |
- # Extract tag name and remove "v" if present
+ set -euo pipefail
TAG_NAME="${GITHUB_REF#refs/tags/}"
VERSION="${TAG_NAME#v}"
- echo "VERSION=${VERSION}" >> "$GITHUB_ENV"
- echo "BUILD_TIME=$(date)" >> "$GITHUB_ENV"
- -
- name: Build and push
- uses: docker/build-push-action@v6
+ if [[ "$TAG_NAME" == *-rc* ]]; then
+ CHANNEL_TAG="rc"
+ else
+ CHANNEL_TAG="latest"
+ fi
+ {
+ echo "VERSION=${VERSION}"
+ echo "CHANNEL_TAG=${CHANNEL_TAG}"
+ echo "BUILD_TIME=$(date -u +%Y-%m-%dT%H:%M:%SZ)"
+ } >> "$GITHUB_ENV"
+
+ - name: Build and push
+ uses: docker/build-push-action@v7
with:
push: true
- file: "./docker/Dockerfile"
+ file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
build-args: |
VERSION=${{ env.VERSION }}
BUILD_DATE=${{ env.BUILD_TIME }}
COMMIT=${{ github.sha }}
tags: |
- "${{vars.BUILDKIT_IMAGE}}:${{ env.VERSION }}"
- "${{vars.BUILDKIT_IMAGE}}:rc"
+ ${{ vars.BUILDKIT_IMAGE }}:${{ env.VERSION }}
+ ${{ vars.BUILDKIT_IMAGE }}:${{ env.CHANNEL_TAG }}
+ cache-from: type=gha
+ cache-to: type=gha,mode=max