Skip to content

feat: add node wrapper script to execute platform-specific ccg binary #5

feat: add node wrapper script to execute platform-specific ccg binary

feat: add node wrapper script to execute platform-specific ccg binary #5

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.exe
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
run: |
go build -tags "fts5" -ldflags "-s -w" -o ${{ matrix.artifact }} ./cmd/ccg/
- name: Compress (Unix)
if: matrix.goos != 'windows'
run: |
tar czf ${{ matrix.artifact }}.tar.gz ${{ matrix.artifact }}
- name: Compress (Windows)
if: matrix.goos == 'windows'
run: |
Compress-Archive -Path ${{ matrix.artifact }} -DestinationPath ccg-windows-amd64.zip
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: |
*.tar.gz
*.zip
release:
needs: build
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-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: 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