137 lines
5.7 KiB
YAML
137 lines
5.7 KiB
YAML
name: Latest builds
|
|
|
|
on: push
|
|
|
|
jobs:
|
|
publish:
|
|
env:
|
|
APP_NAME: timelinize
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel, ubuntu-24.04-arm]
|
|
fail-fast: false
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
|
|
- name: Install Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: stable
|
|
|
|
# TODO: The Windows Server 2022 runner apparently comes with msys2 installed
|
|
# but I haven't looked into using it. We'd have to install the packages using
|
|
# its shell, but I'm not sure how to do that.
|
|
- name: Install MSYS2 (Windows)
|
|
if: matrix.os == 'windows-latest'
|
|
uses: msys2/setup-msys2@v2
|
|
with:
|
|
update: true # gets more current packages (often necessary when we update vips), but takes longer
|
|
install: >-
|
|
base-devel
|
|
mingw-w64-x86_64-toolchain
|
|
mingw-w64-x86_64-libvips
|
|
|
|
- name: Install libraries (Linux)
|
|
if: startsWith(matrix.os, 'ubuntu-')
|
|
uses: ./.github/actions/compile-libvips-linux
|
|
|
|
# On April 22, 2025, we had to separately install glib -- didn't work in the same install command as vips. Compilation fails otherwise. Yes, annotations say it is already installed. Shrug.
|
|
# In late May 2025, installing glib was no longer sufficient; and indeed a warning showed that it was already installed and up-to-date. But the linker couldn't find gio-2.0 (same error as in April).
|
|
# The fix for May's error involved setting CGO_LDFLAGS below using pkg-config (which is also already installed and up-to-date).
|
|
- name: Install libraries (macOS)
|
|
if: ${{ matrix.os == 'macos-latest' || matrix.os == 'macos-15-intel' }}
|
|
run: |
|
|
brew install vips
|
|
|
|
# It is crucial to use our gcc compiler instead of the preinstalled gcc,
|
|
# which has an MSYS2 path at c:\msys64. The MSYS2 we installed is in $RUNNER_TEMP.
|
|
# (Took me months to figure out that the temp dir sometimes is on c:\ and other
|
|
# times it's on d:\! gah.)
|
|
# (Setting `CC` env var is not enough! You MUST *prepend* the PATH env var!)
|
|
- name: Update PATH (Windows)
|
|
if: matrix.os == 'windows-latest'
|
|
shell: bash
|
|
run: echo "$RUNNER_TEMP\msys64\mingw64\bin" >> $GITHUB_PATH
|
|
|
|
# Print versions for troubleshooting purposes
|
|
- name: Check vips version (Windows)
|
|
if: startsWith(matrix.os, 'windows-')
|
|
shell: bash
|
|
run: vips --version
|
|
|
|
- name: Check vips version (Linux)
|
|
if: startsWith(matrix.os, 'ubuntu-')
|
|
run: vips --version
|
|
|
|
- name: Check vips version (macOS)
|
|
if: startsWith(matrix.os, 'macos-')
|
|
run: vips --version
|
|
|
|
# As of May 2025, The CGO_LDFLAGS env var is necessary on macOS since it can't find gio-2.0 otherwise.
|
|
# LLMs also suggested adding:
|
|
# - export CGO_CFLAGS="$(pkg-config --cflags gio-2.0 vips)"
|
|
# - export PKG_CONFIG_PATH="/opt/homebrew/lib/pkgconfig:/opt/homebrew/opt/glib/lib/pkgconfig:$PKG_CONFIG_PATH"
|
|
# but they don't seem to be necessary. Adding as a comment in case something breaks AGAIN in the future, maybe they'll help.
|
|
- name: Compile application
|
|
env:
|
|
CGO_ENABLED: 1
|
|
shell: bash
|
|
run: |
|
|
export CGO_LDFLAGS="$(pkg-config --libs gio-2.0 vips)"
|
|
env
|
|
go env
|
|
echo "Building..."
|
|
go build
|
|
echo "Success."
|
|
|
|
# use conventional archive formats for each platform
|
|
|
|
- name: Compress build (Linux)
|
|
if: startsWith(matrix.os, 'ubuntu-')
|
|
run: |
|
|
ARCH=${{ matrix.os == 'ubuntu-latest' && 'x64' || 'arm64' }}
|
|
REF_NAME=$(echo ${{ github.ref_name }} | sed 's|/|-|g')
|
|
export ARTIFACT_NAME="${{ env.APP_NAME }}_${REF_NAME}_linux_${ARCH}.tar.gz"
|
|
echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> $GITHUB_ENV
|
|
tar -czvf "$ARTIFACT_NAME" ${{ env.APP_NAME }}
|
|
|
|
- name: Compress build (Windows)
|
|
if: matrix.os == 'windows-latest'
|
|
run: |
|
|
$env:ARTIFACT_NAME = "${{ env.APP_NAME }}_${{ github.ref_name }}_windows_x64.zip"
|
|
echo "ARTIFACT_NAME=$env:ARTIFACT_NAME" >> $env:GITHUB_ENV
|
|
7z a "$env:ARTIFACT_NAME" ${{ env.APP_NAME }}.exe -r
|
|
|
|
- name: Compress build (macOS arm64)
|
|
if: matrix.os == 'macos-latest'
|
|
run: |
|
|
REF_NAME=$(echo ${{ github.ref_name }} | sed 's|/|-|g')
|
|
export ARTIFACT_NAME="${{ env.APP_NAME }}_${REF_NAME}_mac_arm64.zip"
|
|
echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> $GITHUB_ENV
|
|
zip "$ARTIFACT_NAME" ${{ env.APP_NAME }}
|
|
|
|
- name: Compress build (macOS x64)
|
|
if: matrix.os == 'macos-15-intel'
|
|
run: |
|
|
REF_NAME=$(echo ${{ github.ref_name }} | sed 's|/|-|g')
|
|
export ARTIFACT_NAME="${{ env.APP_NAME }}_${REF_NAME}_mac_x64.zip"
|
|
echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> $GITHUB_ENV
|
|
zip "$ARTIFACT_NAME" ${{ env.APP_NAME }}
|
|
|
|
# always create an artifact so users can conveniently download updated builds to test patches
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ env.ARTIFACT_NAME }}
|
|
path: ${{ env.ARTIFACT_NAME }}
|
|
|
|
# only do releases on tags; if another runner already made the release, we only upload the
|
|
# artifact from this platform to it
|
|
- name: Publish release (tags only)
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
run: |
|
|
gh release create --generate-notes --target ${{ github.sha }} "${{ github.ref_name }}" "${{ env.ARTIFACT_NAME }}" \
|
|
|| gh release upload "${{ github.ref_name }}" "${{ env.ARTIFACT_NAME }}"
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|