Skip to content

Fix profile test cleanup in CI #2

Fix profile test cleanup in CI

Fix profile test cleanup in CI #2

Workflow file for this run

name: GitHub Release
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
env:
BINARY_NAME: kbr
jobs:
build-linux-amd64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Install OCR build dependencies
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libtesseract-dev libleptonica-dev tesseract-ocr
- name: Build OCR binary
env:
CGO_ENABLED: "1"
GOOS: linux
GOARCH: amd64
run: |
mkdir -p dist/linux-amd64
go build -trimpath -tags=ocr \
-ldflags "-s -w \
-X github.com/libi/ko-browser/cmd.version=${{ github.ref_name }} \
-X github.com/libi/ko-browser/cmd.commit=${{ github.sha }} \
-X github.com/libi/ko-browser/cmd.date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
-o dist/linux-amd64/${BINARY_NAME} ./cmd/kbr
- name: Package
run: |
tar czf ko-browser-linux-amd64.tar.gz -C dist/linux-amd64 ${BINARY_NAME}
- uses: actions/upload-artifact@v4
with:
name: ko-browser-linux-amd64
path: ko-browser-linux-amd64.tar.gz
build-linux-arm64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Build OCR binary in ARM64 container
run: |
docker run --rm --platform linux/arm64 \
-v "${{ github.workspace }}:/workspace" \
-w /workspace \
golang:1.26-bookworm \
bash -lc '
apt-get update &&
apt-get install -y pkg-config libtesseract-dev libleptonica-dev tesseract-ocr &&
mkdir -p dist/linux-arm64 &&
export CGO_ENABLED=1 GOOS=linux GOARCH=arm64 &&
go build -trimpath -tags=ocr \
-ldflags "-s -w \
-X github.com/libi/ko-browser/cmd.version=${{ github.ref_name }} \
-X github.com/libi/ko-browser/cmd.commit=${{ github.sha }} \
-X github.com/libi/ko-browser/cmd.date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
-o dist/linux-arm64/kbr ./cmd/kbr &&
tar czf ko-browser-linux-arm64.tar.gz -C dist/linux-arm64 kbr
'
- uses: actions/upload-artifact@v4
with:
name: ko-browser-linux-arm64
path: ko-browser-linux-arm64.tar.gz
build-darwin-amd64:
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Install OCR build dependencies
run: |
brew install tesseract pkg-config
- name: Build OCR binary
env:
CGO_ENABLED: "1"
GOOS: darwin
GOARCH: amd64
run: |
mkdir -p dist/darwin-amd64
go build -trimpath -tags=ocr \
-ldflags "-s -w \
-X github.com/libi/ko-browser/cmd.version=${{ github.ref_name }} \
-X github.com/libi/ko-browser/cmd.commit=${{ github.sha }} \
-X github.com/libi/ko-browser/cmd.date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
-o dist/darwin-amd64/${BINARY_NAME} ./cmd/kbr
- name: Package
run: |
tar czf ko-browser-darwin-amd64.tar.gz -C dist/darwin-amd64 ${BINARY_NAME}
- uses: actions/upload-artifact@v4
with:
name: ko-browser-darwin-amd64
path: ko-browser-darwin-amd64.tar.gz
build-darwin-arm64:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Install OCR build dependencies
run: |
brew install tesseract pkg-config
- name: Build OCR binary
env:
CGO_ENABLED: "1"
GOOS: darwin
GOARCH: arm64
run: |
mkdir -p dist/darwin-arm64
go build -trimpath -tags=ocr \
-ldflags "-s -w \
-X github.com/libi/ko-browser/cmd.version=${{ github.ref_name }} \
-X github.com/libi/ko-browser/cmd.commit=${{ github.sha }} \
-X github.com/libi/ko-browser/cmd.date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
-o dist/darwin-arm64/${BINARY_NAME} ./cmd/kbr
- name: Package
run: |
tar czf ko-browser-darwin-arm64.tar.gz -C dist/darwin-arm64 ${BINARY_NAME}
- uses: actions/upload-artifact@v4
with:
name: ko-browser-darwin-arm64
path: ko-browser-darwin-arm64.tar.gz
build-windows-amd64:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
path-type: inherit
update: true
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-pkg-config
mingw-w64-x86_64-tesseract-ocr
mingw-w64-x86_64-leptonica
- name: Build OCR binary
run: |
mkdir -p dist/windows-amd64
export CGO_ENABLED=1
export GOOS=windows
export GOARCH=amd64
export CC=gcc
go build -trimpath -tags=ocr \
-ldflags "-s -w \
-X github.com/libi/ko-browser/cmd.version=${{ github.ref_name }} \
-X github.com/libi/ko-browser/cmd.commit=${{ github.sha }} \
-X github.com/libi/ko-browser/cmd.date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
-o dist/windows-amd64/${BINARY_NAME}.exe ./cmd/kbr
- name: Package
shell: pwsh
run: |
Compress-Archive -Path "dist/windows-amd64/${{ env.BINARY_NAME }}.exe" -DestinationPath "ko-browser-windows-amd64.zip"
- uses: actions/upload-artifact@v4
with:
name: ko-browser-windows-amd64
path: ko-browser-windows-amd64.zip
release:
needs:
- build-linux-amd64
- build-linux-arm64
- build-darwin-amd64
- build-darwin-arm64
- build-windows-amd64
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Generate checksums
run: |
cd artifacts
sha256sum *.tar.gz *.zip > checksums.txt
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
artifacts/*.tar.gz
artifacts/*.zip
artifacts/checksums.txt