Skip to content

fix: store graph strings as text #30

fix: store graph strings as text

fix: store graph strings as text #30

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build:
strategy:
matrix:
include:
- os: macos-latest
goos: darwin
goarch: arm64
artifact: ccg-darwin-arm64
- os: macos-15-intel
goos: darwin
goarch: amd64
artifact: ccg-darwin-amd64
- os: ubuntu-latest
goos: linux
goarch: amd64
artifact: ccg-linux-amd64
- os: ubuntu-latest
goos: linux
goarch: arm64
artifact: ccg-linux-arm64
- os: windows-latest
goos: windows
goarch: amd64
artifact: ccg-windows-amd64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Install cross-compiler (Linux ARM64)
if: matrix.goos == 'linux' && matrix.goarch == 'arm64'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
echo "CC=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 1
shell: bash
run: |
VERSION=${GITHUB_REF#refs/tags/}
COMMIT=${GITHUB_SHA::7}
DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)
BIN_EXT=""
if [ "${{ matrix.goos }}" = "windows" ]; then
BIN_EXT=".exe"
fi
mkdir -p dist
go build -tags "fts5" -ldflags "-s -w -X main.version=${VERSION} -X main.commit=${COMMIT} -X main.date=${DATE}" -o "dist/ccg${BIN_EXT}" ./cmd/ccg/
go build -tags "fts5" -ldflags "-s -w -X main.version=${VERSION} -X main.commit=${COMMIT} -X main.date=${DATE}" -o "dist/ccg-server${BIN_EXT}" ./cmd/ccg-server/
- name: Install UPX (Linux)
if: runner.os == 'Linux'
run: sudo apt-get install -y upx-ucl
- name: Install UPX (macOS)
if: runner.os == 'macOS'
run: brew install upx
- name: Install UPX (Windows)
if: runner.os == 'Windows'
run: choco install upx -y
- name: Compress binary with UPX
continue-on-error: true
shell: bash
run: upx --best --lzma dist/*
- name: Compress (Unix)
if: matrix.goos != 'windows'
run: |
tar czf ${{ matrix.artifact }}.tar.gz -C dist ccg ccg-server
- name: Compress (Windows)
if: matrix.goos == 'windows'
run: |
Compress-Archive -Path dist/* -DestinationPath ccg-windows-amd64.zip
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: |
*.tar.gz
*.zip
wiki-dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
cache: npm
cache-dependency-path: web/wiki/package-lock.json
- name: Build Wiki UI
working-directory: web/wiki
run: |
npm ci
npm run build
- name: Package Wiki UI
run: tar czf ccg-wiki-dist.tar.gz -C web/wiki/dist .
- name: Upload Wiki artifact
uses: actions/upload-artifact@v4
with:
name: ccg-wiki-dist
path: ccg-wiki-dist.tar.gz
release:
needs:
- build
- wiki-dist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Create Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
artifacts/*.tar.gz
artifacts/*.zip
publish-container:
needs: release
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v6
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract container metadata
id: metadata
uses: docker/metadata-action@v6
with:
images: ghcr.io/${{ github.repository }}
flavor: latest=false
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable=${{ !contains(github.ref_name, '-') }}
- name: Prepare container build metadata
id: build-meta
shell: bash
run: |
echo "version=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
echo "commit=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
echo "date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_OUTPUT"
- name: Build and publish container image
uses: docker/build-push-action@v7
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
build-args: |
VERSION=${{ steps.build-meta.outputs.version }}
COMMIT=${{ steps.build-meta.outputs.commit }}
DATE=${{ steps.build-meta.outputs.date }}
cache-from: type=gha
cache-to: type=gha,mode=max
publish-npm:
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Copy README for npm
run: cp README.md npm/README.md
- name: Set version from tag
run: |
VERSION=${GITHUB_REF#refs/tags/v}
cd npm
npm version $VERSION --no-git-tag-version
- name: Publish to npm
working-directory: npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access public