v0.8.0 #20
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release binaries | |
on: | |
release: | |
types: [created] | |
env: | |
GO_VERSION: "1.22" | |
PDFIUM_VERSION: "6392" | |
jobs: | |
release-webassembly: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest, macos-latest, windows-latest ] | |
runs-on: ${{ matrix.os }} | |
env: | |
CGO_ENABLED: 0 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Build Linux | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
GOARCH=amd64 go build -ldflags "-X 'github.com/klippa-app/pdfium-cli/version.VERSION=${{ github.event.release.name }}'" -o artifacts/pdfium-webassembly-linux-amd64 main.go | |
GOARCH=arm64 go build -ldflags "-X 'github.com/klippa-app/pdfium-cli/version.VERSION=${{ github.event.release.name }}'" -o artifacts/pdfium-webassembly-linux-arm64 main.go | |
- name: Build MacOS | |
if: matrix.os == 'macos-latest' | |
run: | | |
GOARCH=amd64 go build -ldflags "-X 'github.com/klippa-app/pdfium-cli/version.VERSION=${{ github.event.release.name }}'" -o artifacts/pdfium-webassembly-mac-amd64 main.go | |
GOARCH=arm64 go build -ldflags "-X 'github.com/klippa-app/pdfium-cli/version.VERSION=${{ github.event.release.name }}'" -o artifacts/pdfium-webassembly-mac-arm64 main.go | |
- name: Build Windows | |
if: matrix.os == 'windows-latest' | |
run: | | |
$env:GOARCH = 'amd64' | |
go build -ldflags "-X 'github.com/klippa-app/pdfium-cli/version.VERSION=${{ github.event.release.name }}'" -o artifacts/pdfium-webassembly-windows-amd64 main.go | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: builds | |
path: artifacts | |
- uses: AButler/upload-release-assets@v3.0 | |
with: | |
files: 'artifacts/*' | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
release-cgo-linux: | |
env: | |
CGO_ENABLED: 1 | |
LD_LIBRARY_PATH: "/opt/pdfium/lib" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Set up PDFium library libjpeg-turbo | |
run: | | |
sudo curl -L https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F${{ env.PDFIUM_VERSION }}/pdfium-linux-x64.tgz -o pdfium-linux-x64.tgz && sudo mkdir /opt/pdfium && sudo tar -C /opt/pdfium -xvf pdfium-linux-x64.tgz | |
sudo rm pdfium-linux-x64.tgz | |
sudo cp ./.github/workflows/pdfium.pc /usr/lib/pkgconfig/pdfium.pc | |
sudo apt-get update -y | |
sudo apt-get install -y libturbojpeg libturbojpeg-dev | |
- name: Build | |
run: | | |
go build -tags pdfium_experimental,pdfium_cli_use_cgo,pdfium_use_turbojpeg -ldflags "-X 'github.com/klippa-app/pdfium-cli/version.VERSION=${{ github.event.release.name }}'" -o artifacts/pdfium-native-linux-amd64 main.go | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: builds | |
path: artifacts | |
- uses: AButler/upload-release-assets@v3.0 | |
with: | |
files: 'artifacts/*' | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
release-cgo-linux-musl: | |
env: | |
CGO_ENABLED: 1 | |
CC: "musl-gcc" | |
LD_LIBRARY_PATH: "/opt/pdfium/lib:/opt/libjpegturbo/libjpeg-turbo-3.0.3/build" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Set up PDFium library, musl and libjpeg-turbo | |
run: | | |
sudo curl -L https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F${{ env.PDFIUM_VERSION }}/pdfium-linux-musl-x64.tgz -o pdfium-linux-musl-x64.tgz && sudo mkdir /opt/pdfium && sudo tar -C /opt/pdfium -xvf pdfium-linux-musl-x64.tgz | |
sudo rm pdfium-linux-musl-x64.tgz | |
sudo cp ./.github/workflows/pdfium.pc /usr/lib/pkgconfig/pdfium.pc | |
sudo cp ./.github/workflows/libturbojpeg.pc /usr/lib/pkgconfig/libturbojpeg.pc | |
sudo apt-get update -y | |
sudo apt-get install -y musl-dev musl-tools | |
sudo curl -L https://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/3.0.3/libjpeg-turbo-3.0.3.tar.gz -o libjpeg-turbo-3.0.3.tar.gz && sudo mkdir /opt/libjpegturbo && sudo tar -C /opt/libjpegturbo -xvf libjpeg-turbo-3.0.3.tar.gz | |
cd /opt/libjpegturbo/libjpeg-turbo-3.0.3 && sudo mkdir build && cd build | |
sudo cmake -G"Unix Makefiles" -DCMAKE_C_COMPILER=musl-gcc -DWITH_JPEG8=1 -DCMAKE_BUILD_TYPE=None ../ | |
sudo make turbojpeg | |
- name: Build | |
run: | | |
go build --ldflags '-linkmode external -extldflags "-fno-PIC -L/opt/libjpegturbo/libjpeg-turbo-3.0.3/build"' -tags pdfium_experimental,pdfium_cli_use_cgo,pdfium_use_turbojpeg -ldflags "-X 'github.com/klippa-app/pdfium-cli/version.VERSION=${{ github.event.release.name }}'" -o artifacts/pdfium-native-linux-musl-amd64 main.go | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: builds | |
path: artifacts | |
- uses: AButler/upload-release-assets@v3.0 | |
with: | |
files: 'artifacts/*' | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
release-cgo-macos-arm64: | |
env: | |
CGO_ENABLED: 1 | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Set up PDFium library and libjpeg-turbo | |
run: | | |
sudo curl -L https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F${{ env.PDFIUM_VERSION }}/pdfium-mac-arm64.tgz -o pdfium-mac-arm64.tgz && sudo mkdir /opt/pdfium && sudo tar -C /opt/pdfium -xvf pdfium-mac-arm64.tgz | |
sudo rm pdfium-mac-arm64.tgz | |
sudo cp ./.github/workflows/pdfium.pc /opt/pdfium/pdfium.pc | |
brew install jpeg-turbo | |
- name: Build | |
run: | | |
export LD_LIBRARY_PATH="/opt/pdfium/lib" | |
export PKG_CONFIG_PATH="/opt/pdfium" | |
go build -tags pdfium_experimental,pdfium_cli_use_cgo,pdfium_use_turbojpeg -ldflags "-X 'github.com/klippa-app/pdfium-cli/version.VERSION=${{ github.event.release.name }}'" -o artifacts/pdfium-native-mac-arm64 main.go | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: builds | |
path: artifacts | |
- uses: AButler/upload-release-assets@v3.0 | |
with: | |
files: 'artifacts/*' | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
release-cgo-macos-x64: | |
env: | |
CGO_ENABLED: 1 | |
runs-on: macos-13 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Set up PDFium library and libjpeg-turbo | |
run: | | |
sudo curl -L https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F${{ env.PDFIUM_VERSION }}/pdfium-mac-x64.tgz -o pdfium-mac-x64.tgz && sudo mkdir /opt/pdfium && sudo tar -C /opt/pdfium -xvf pdfium-mac-x64.tgz | |
sudo rm pdfium-mac-x64.tgz | |
sudo cp ./.github/workflows/pdfium.pc /opt/pdfium/pdfium.pc | |
brew install jpeg-turbo | |
- name: Build | |
run: | | |
export LD_LIBRARY_PATH="/opt/pdfium/lib" | |
export PKG_CONFIG_PATH="/opt/pdfium" | |
go build -tags pdfium_experimental,pdfium_cli_use_cgo,pdfium_use_turbojpeg -ldflags "-X 'github.com/klippa-app/pdfium-cli/version.VERSION=${{ github.event.release.name }}'" -o artifacts/pdfium-native-mac-amd64 main.go | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: builds | |
path: artifacts | |
- uses: AButler/upload-release-assets@v3.0 | |
with: | |
files: 'artifacts/*' | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
release-cgo-windows: | |
env: | |
CGO_ENABLED: 1 | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Set up PDFium library and libjpeg-turbo | |
run: | | |
curl -L https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F${{ env.PDFIUM_VERSION }}/pdfium-win-x64.tgz -o pdfium-win-x64.tgz | |
mkdir -p D:\opt\pdfium | |
tar -C D:\opt\pdfium -xvf pdfium-win-x64.tgz | |
rm pdfium-win-x64.tgz | |
mkdir D:\opt\pkgconfig | |
cp ./.github/workflows/pdfium-windows.pc D:\opt\pkgconfig\pdfium.pc | |
curl -L https://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/3.0.3/libjpeg-turbo-3.0.3-gcc64.exe -o libjpeg-turbo-3.0.3-gcc64.exe | |
./libjpeg-turbo-3.0.3-gcc64.exe /S | |
$Folder = 'C:\libjpeg-turbo-gcc64\lib\pkgconfig' | |
while (!(Test-Path -Path $Folder)) { | |
"libjpeg-turbo does not exist yet!" | |
Start-Sleep -s 5 | |
} | |
- name: Build | |
run: | | |
$env:PKG_CONFIG_PATH = 'D:\opt\pkgconfig;C:\libjpeg-turbo-gcc64\lib\pkgconfig' | |
$env:Path += ";D:\opt\pdfium\bin;C:\libjpeg-turbo-gcc64\bin" | |
go build -tags pdfium_experimental,pdfium_cli_use_cgo,pdfium_use_turbojpeg -ldflags "-X 'github.com/klippa-app/pdfium-cli/version.VERSION=${{ github.event.release.name }}'" -o artifacts/pdfium-native-windows-amd64 main.go | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: builds | |
path: artifacts | |
- uses: AButler/upload-release-assets@v3.0 | |
with: | |
files: 'artifacts/*' | |
repo-token: ${{ secrets.GITHUB_TOKEN }} |