phase6: Dockerfile, CI workflows, GHCR release pipeline

This commit is contained in:
Sergey Filkin
2026-04-18 12:38:43 +03:00
parent 08d12feaa9
commit 4b55661aa4
4 changed files with 269 additions and 0 deletions
+79
View File
@@ -0,0 +1,79 @@
name: release
on:
push:
tags:
- "v*"
permissions:
contents: write
packages: write
jobs:
release:
runs-on: ubuntu-latest
env:
TAILWIND_VERSION: v3.4.17
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Install templ
run: go install github.com/a-h/templ/cmd/templ@v0.3.1001
- name: Install tailwindcss standalone
run: |
curl -fsSL -o /usr/local/bin/tailwindcss \
"https://github.com/tailwindlabs/tailwindcss/releases/download/${TAILWIND_VERSION}/tailwindcss-linux-x64"
chmod +x /usr/local/bin/tailwindcss
- name: Build assets
run: |
mkdir -p web/static/dist
templ generate ./...
tailwindcss -c tailwind.config.js -i web/static/src/app.css -o web/static/dist/app.css --minify
- name: Cross-compile binaries
run: |
mkdir -p dist
for target in "linux amd64" "linux arm64" "darwin arm64"; do
set -- $target
GOOS=$1 GOARCH=$2 CGO_ENABLED=0 go build -trimpath \
-ldflags="-s -w -X github.com/fserg/md-to-html/internal/version.Version=$(cat VERSION)" \
-o "dist/md-to-html-${1}-${2}" \
./cmd/md-to-html
done
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/${{ github.repository }}:${{ github.ref_name }}
ghcr.io/${{ github.repository }}:latest
- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${{ github.ref_name }}" \
--title "${{ github.ref_name }}" \
--notes-file CHANGELOG.md \
dist/*