diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml deleted file mode 100644 index 37e9650..0000000 --- a/.github/workflows/goreleaser.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: goreleaser - -on: - push: - tags: - - "v*.*.*" -jobs: - goreleaser: - runs-on: ubuntu-latest - environment: release - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: '1.20' - check-latest: true - - name: release dry run - run: make release-dry-run - - name: setup release environment - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: |- - echo 'GITHUB_TOKEN=${{secrets.GITHUB_TOKEN}}' > .release-env - - name: release publish - run: make release diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..89c8942 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,230 @@ +name: Build wikilite + +on: + release: + types: [published] + +jobs: + build-macos-amd64: + name: Build for MacOS AMD64 + runs-on: macos-13 + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.23.4' + + - name: Set up CGO environment + run: | + export CC=clang + export CGO_ENABLED=1 + export GOOS=darwin + export GOARCH=amd64 + + - name: Build wikilite for MacOS AMD64 + run: go build -tags=fts5 -ldflags="-s -w" -o wikilite-macos-amd64 . + + - name: Compress artifact + run: tar -czvf wikilite-macos-amd64.tar.gz wikilite-macos-amd64 + + - name: Upload release asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: wikilite-macos-amd64.tar.gz + asset_name: wikilite-macos-amd64.tar.gz + asset_content_type: application/octet-stream + + build-macos-arm64: + name: Build for MacOS ARM64 + runs-on: macos-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.23.4' + + - name: Set up CGO environment + run: | + export CC=clang + export CGO_ENABLED=1 + export GOOS=darwin + export GOARCH=arm64 + + - name: Build wikilite for MacOS ARM64 + run: go build -tags=fts5 -ldflags="-s -w" -o wikilite-macos-arm64 . + + - name: Compress artifact + run: tar -czvf wikilite-macos-arm64.tar.gz wikilite-macos-arm64 + + - name: Upload release asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: wikilite-macos-arm64.tar.gz + asset_name: wikilite-macos-arm64.tar.gz + asset_content_type: application/octet-stream + + build-linux-amd64: + name: Build for Linux AMD64 + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.23.4' + + - name: Install dependencies + run: sudo apt-get update && sudo apt-get install -y gcc + + - name: Set up CGO environment + run: | + export CC=gcc + export CGO_ENABLED=1 + export GOOS=linux + export GOARCH=amd64 + + - name: Build wikilite for Linux AMD64 + run: go build -tags=fts5 -ldflags="-s -w -extldflags '-static'" -o wikilite-linux-amd64 . + + - name: Compress artifact + run: tar -czvf wikilite-linux-amd64.tar.gz wikilite-linux-amd64 + + - name: Upload release asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: wikilite-linux-amd64.tar.gz + asset_name: wikilite-linux-amd64.tar.gz + asset_content_type: application/octet-stream + + build-linux-arm64: + name: Build for Linux ARM64 + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.23.4' + + - name: Install dependencies + run: sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu + + - name: Set up CGO environment + run: | + export CC=aarch64-linux-gnu-gcc + export CGO_ENABLED=1 + export GOOS=linux + export GOARCH=arm64 + + - name: Build wikilite for Linux ARM64 + run: go build -tags=fts5 -ldflags="-s -w -extldflags '-static'" -o wikilite-linux-arm64 . + + - name: Compress artifact + run: tar -czvf wikilite-linux-arm64.tar.gz wikilite-linux-arm64 + + - name: Upload release asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: wikilite-linux-arm64.tar.gz + asset_name: wikilite-linux-arm64.tar.gz + asset_content_type: application/octet-stream + + build-windows-amd64: + name: Build for Windows AMD64 + runs-on: windows-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.23.4' + + - name: Install dependencies + run: choco install mingw -y + + - name: Set up CGO environment + run: | + $env:CC = "x86_64-w64-mingw32-gcc" + $env:CGO_ENABLED = "1" + $env:GOOS = "windows" + $env:GOARCH = "amd64" + + - name: Build wikilite for Windows AMD64 + run: go build -tags=fts5 -ldflags="-s -w" -o wikilite-windows-amd64.exe . + + - name: Compress artifact + run: Compress-Archive -Path wikilite-windows-amd64.exe -DestinationPath wikilite-windows-amd64.zip + + - name: Upload release asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: wikilite-windows-amd64.zip + asset_name: wikilite-windows-amd64.zip + asset_content_type: application/octet-stream + + build-windows-arm64: + name: Build for Windows ARM64 + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.23.4' + + - name: Install dependencies for Windows ARM64 cross-compilation + run: | + sudo apt-get update + sudo apt-get install -y gcc-mingw-w64 + + - name: Set up CGO environment for Windows ARM64 + run: | + export CC=aarch64-w64-mingw32-gcc + export CGO_ENABLED=1 + export GOOS=windows + export GOARCH=arm64 + + - name: Build wikilite for Windows ARM64 + run: go build -tags=fts5 -ldflags="-s -w" -o wikilite-windows-arm64.exe . + + - name: Compress artifact + run: zip wikilite-windows-arm64.zip wikilite-windows-arm64.exe + + - name: Upload release asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: wikilite-windows-arm64.zip + asset_name: wikilite-windows-arm64.zip + asset_content_type: application/octet-stream diff --git a/.goreleaser.yml b/.goreleaser.yml deleted file mode 100644 index 871aff4..0000000 --- a/.goreleaser.yml +++ /dev/null @@ -1,140 +0,0 @@ -before: - hooks: - - go mod download - - apt-get update -y - - apt-get install -y gcc-multilib libsqlite3-dev - -builds: - - id: "wikilite-darwin-amd64" - main: . - binary: wikilite - env: - - CGO_ENABLED=1 - - CC=o64-clang - - CXX=o64-clang++ - goos: - - darwin - goarch: - - amd64 - flags: - - -tags=fts5 - ldflags: - - -s -w - - id: "wikilite-darwin-arm64" - main: . - binary: wikilite - env: - - CGO_ENABLED=1 - - CC=oa64-clang - - CXX=oa64-clang++ - goos: - - darwin - goarch: - - arm64 - flags: - - -tags=fts5 - ldflags: - - -s -w - - id: "wikilite-linux-amd64" - main: . - binary: wikilite - env: - - CGO_ENABLED=1 - - CC=gcc - - CXX=g++ - goos: - - linux - goarch: - - amd64 - flags: - - -tags=fts5 - ldflags: - - -s -w -extldflags "-static" - - id: "wikilite-linux-i386" - main: . - binary: wikilite - env: - - CGO_ENABLED=1 - - CC=gcc - - CXX=g++ - goos: - - linux - goarch: - - 386 - flags: - - -tags=fts5 -m32 - ldflags: - - -s -w -extldflags "-static" - - id: "wikilite-linux-arm64" - main: . - binary: wikilite - env: - - CGO_ENABLED=1 - - CC=aarch64-linux-gnu-gcc - - CXX=aarch64-linux-gnu-g++ - goos: - - linux - goarch: - - arm64 - flags: - - -tags=fts5 - ldflags: - - -s -w -extldflags "-static" - - id: "wikilite-windows-amd64" - main: . - binary: wikilite - env: - - CGO_ENABLED=1 - - CC=x86_64-w64-mingw32-gcc - - CXX=x86_64-w64-mingw32-g++ - goos: - - windows - goarch: - - amd64 - flags: - - -tags=fts5 - - -buildmode=exe - ldflags: - - -s -w - - id: "wikilite-windows-arm64" - main: . - binary: wikilite - goos: - - windows - goarch: - - arm64 - env: - - CGO_ENABLED=1 - - CC=/llvm-mingw/bin/aarch64-w64-mingw32-gcc - - CXX=/llvm-mingw/bin/aarch64-w64-mingw32-g++ - flags: - - -tags=fts5 - - -buildmode=exe - ldflags: - - -s -w -archives: - - name_template: '{{ .ProjectName }}_{{ .Version }}_{{- title .Os }}_{{ .Arch }}' - format_overrides: - - goos: windows - format: zip - builds: - - wikilite-darwin-amd64 - - wikilite-darwin-arm64 - - wikilite-linux-amd64 - - wikilite-linux-arm64 - - wikilite-linux-i386 - - wikilite-windows-amd64 - - wikilite-windows-arm64 - files: - - none* - -checksum: - name_template: 'checksums.txt' -changelog: - sort: asc - filters: - exclude: - - '^docs:' - - '^test:' -snapshot: - name_template: "{{ .Tag }}-next" diff --git a/Makefile b/Makefile index 64e1ce5..4215391 100644 --- a/Makefile +++ b/Makefile @@ -21,31 +21,3 @@ test: wikilite: @go build -tags "fts5" -ldflags "-s -w" -o wikilite . @strip wikilite - -release-dry-run: - docker run \ - --rm \ - --privileged \ - -e CGO_ENABLED=1 \ - -v /var/run/docker.sock:/var/run/docker.sock \ - -v `pwd`:/go/src/$(PACKAGE_NAME) \ - -v ${GOPATH}/pkg:/go/pkg \ - -w /go/src/$(PACKAGE_NAME) \ - ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \ - --clean --skip-validate --skip-publish --snapshot - -release: - @if [ ! -f ".release-env" ]; then \ - echo "\033[91m.release-env is required for release\033[0m";\ - exit 1;\ - fi - docker run \ - --rm \ - --privileged \ - -e CGO_ENABLED=1 \ - --env-file .release-env \ - -v /var/run/docker.sock:/var/run/docker.sock \ - -v `pwd`:/go/src/$(PACKAGE_NAME) \ - -w /go/src/$(PACKAGE_NAME) \ - ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \ - release --clean --skip-validate diff --git a/main.go b/main.go index 4950bb9..e277fef 100644 --- a/main.go +++ b/main.go @@ -10,7 +10,7 @@ import ( "os" ) -const Version = "0.1.6" +const Version = "0.2.0" type Config struct { ai bool