Skip to content

first official release #2

first official release

first official release #2

Workflow file for this run

name: Build and Release
on:
push:
branches:
- ci
workflow_dispatch:
permissions:
contents: write
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: false
jobs:
build:
name: Build (${{ matrix.goos }}/${{ matrix.goarch }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
goos: linux
goarch: amd64
artifact_name: backend-linux-amd64
- os: ubuntu-latest
goos: linux
goarch: arm64
artifact_name: backend-linux-arm64
# --- Additional targets (disabled for now) ---
# - os: windows-latest
# goos: windows
# goarch: amd64
# artifact_name: backend-windows-amd64.exe
# - os: windows-latest
# goos: windows
# goarch: arm64
# artifact_name: backend-windows-arm64.exe
# - os: macos-13 # Intel runner
# goos: darwin
# goarch: amd64
# artifact_name: backend-darwin-amd64
# - os: macos-14 # Apple Silicon runner
# goos: darwin
# goarch: arm64
# artifact_name: backend-darwin-arm64
steps:
- name: Checkout repository (with submodules)
uses: actions/checkout@v4
with:
token: ${{ secrets.BOT_PAT }}
submodules: recursive
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: backend/go.mod
- name: Set up Node.js (for frontend build)
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Build
working-directory: backend
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
chmod +x ./full_build.sh
./full_build.sh
- name: Read version from metrics handler
id: get_version
shell: bash
run: |
VERSION=$(sed -n 's/.*var VERSION = "\(.*\)".*/\1/p' backend/api/metrics/handler.go)
echo "Detected version: $VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Prepare artifact
if: ${{ success() }}
shell: bash
working-directory: backend
run: |
mkdir -p ../dist
BIN_NAME="backend"
EXT=""
if [[ "${{ matrix.goos }}" == "windows" ]]; then EXT=".exe"; fi
OUT_NAME="open-chat-${{ steps.get_version.outputs.version }}-${{ matrix.goarch }}"
if [[ "$EXT" == ".exe" ]]; then OUT_NAME+="$EXT"; fi
mv -f "$BIN_NAME$EXT" "../dist/$OUT_NAME"
- name: Upload artifact
if: ${{ success() }}
uses: actions/upload-artifact@v4
with:
name: open-chat-${{ steps.get_version.outputs.version }}-${{ matrix.goarch }}
path: dist/open-chat-${{ steps.get_version.outputs.version }}-${{ matrix.goarch }}*
if-no-files-found: error
release:
name: Create Release
runs-on: ubuntu-latest
needs: [build]
if: always()
steps:
- name: Download all build artifacts
uses: actions/download-artifact@v4
with:
path: all-artifacts
- name: Summarize collected artifacts
run: |
echo "Artifacts collected:" || true
ls -R all-artifacts || true
- name: Create source archive
run: |
git archive --format=zip --output=source-clean.zip HEAD -- . ':!frontend' ':!backend/federation' ':!backend/federation_factory' ':!backend/api/federation' ':!backend/api/federation_disabled.go' ':!backend/api/federation_interface.go' ':!backend/server/federation.go' ':!backend/database/federation.go'
echo "Created source-clean.zip without frontend and federation code"
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
if: always()
with:
tag_name: build-${{ github.run_number }}
name: Build ${{ github.run_number }}
draft: false
prerelease: false
files: |
all-artifacts/**/*
source-clean.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}