max-telegram-bridge-bot/.github/workflows/release.yml
Andrey Lugovskoy 474555fd31
Some checks failed
Build / build (push) Has been cancelled
Fix release workflow: pass changelog via file to avoid shell expansion
Backticks in commit messages caused 'no matches found' errors when
changelog was interpolated into shell string. Use --notes-file instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 21:40:15 +04:00

76 lines
2.1 KiB
YAML

name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
packages: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y gcc gcc-aarch64-linux-gnu
- name: Build linux/amd64
run: CGO_ENABLED=1 GOOS=linux GOARCH=amd64 CC=gcc go build -o max-telegram-bridge-bot-linux-amd64 .
- name: Build linux/arm64
run: CGO_ENABLED=1 GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc go build -o max-telegram-bridge-bot-linux-arm64 .
- name: Generate changelog
run: |
PREV_TAG=$(git tag --sort=-v:refname | head -2 | tail -1)
if [ -z "$PREV_TAG" ] || [ "$PREV_TAG" = "${{ github.ref_name }}" ]; then
git log --oneline --no-merges -20 > changelog.txt
else
git log --oneline --no-merges ${PREV_TAG}..HEAD > changelog.txt
fi
- name: Create release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create ${{ github.ref_name }} \
--title "${{ github.ref_name }}" \
--notes-file changelog.txt \
max-telegram-bridge-bot-linux-amd64 \
max-telegram-bridge-bot-linux-arm64
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Lowercase repo name
id: repo
run: echo "name=${GITHUB_REPOSITORY,,}" >> "$GITHUB_OUTPUT"
- uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: linux/amd64
tags: |
ghcr.io/${{ steps.repo.outputs.name }}:${{ github.ref_name }}
ghcr.io/${{ steps.repo.outputs.name }}:latest