Files
Sergey Filkin a90519807c
release / release (push) Has been cancelled
phase7: release v0.2.1
2026-04-18 13:32:31 +03:00

86 lines
2.4 KiB
YAML

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 }}
- name: Compute image name
id: image
run: |
repo_lower=$(echo "${GITHUB_REPOSITORY}" | tr '[:upper:]' '[:lower:]')
echo "name=ghcr.io/${repo_lower}" >> "${GITHUB_OUTPUT}"
- 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: |
${{ steps.image.outputs.name }}:${{ github.ref_name }}
${{ steps.image.outputs.name }}: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/*