Skip to content

ci: fix docker-release workflow heredoc syntax #6

ci: fix docker-release workflow heredoc syntax

ci: fix docker-release workflow heredoc syntax #6

Workflow file for this run

name: Build and Release
on:
push:
tags:
- 'v*'
jobs:
build:
name: Build ${{ matrix.os }}-${{ matrix.arch }}
runs-on: ${{ matrix.runs-on }}
strategy:
matrix:
include:
- os: windows
arch: amd64
runs-on: windows-latest
output: testops-mcp-windows-amd64.exe
- os: windows
arch: arm64
runs-on: windows-latest
output: testops-mcp-windows-arm64.exe
- os: darwin
arch: amd64
runs-on: macos-latest
output: testops-mcp-macos-amd64
- os: darwin
arch: arm64
runs-on: macos-latest
output: testops-mcp-macos-arm64
- os: linux
arch: amd64
runs-on: ubuntu-latest
output: testops-mcp-linux-amd64
- os: linux
arch: arm64
runs-on: ubuntu-latest
output: testops-mcp-linux-arm64
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: '1.26'
- name: Build
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
run: |
mkdir -p build/releases
go build -o build/releases/${{ matrix.output }} ./cmd/server/main.go
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.output }}
path: build/releases/${{ matrix.output }}
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Flatten artifacts
run: |
mkdir -p release-assets
find artifacts -type f -exec mv {} release-assets/ \;
ls -la release-assets/
- name: Extract release notes from CHANGELOG
id: changelog
run: |
# Extract version number from tag
VERSION=${{ github.ref_name }}
# Extract section for this version from CHANGELOG.md
# This is a simplified extraction - adjust regex as needed
NOTES=$(sed -n "/## \[${VERSION#v}\]/,/## \[/p" CHANGELOG.md | head -n -1)
# If not found, use a default message
if [ -z "$NOTES" ]; then
NOTES="Release $VERSION"
fi
# Write to file for action
echo "$NOTES" > release_notes.txt
cat release_notes.txt
- name: Create or Update Release
uses: softprops/action-gh-release@v1
with:
files: release-assets/*
body_path: release_notes.txt
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}