Skip to content

Automate release generation from tags and refactor CI #14

Automate release generation from tags and refactor CI

Automate release generation from tags and refactor CI #14

Workflow file for this run

name: Build
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
build:
name: ${{ matrix.os }} with BUILD_SHARED_LIBS=${{matrix.shared}}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
shared: [ON, OFF]
permissions:
contents: write
attestations: write
id-token: write
steps:
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
if: matrix.os == 'windows-latest'
- name: Support longpaths
run: git config --system core.longpaths true
if: matrix.os == 'windows-latest'
- uses: mamba-org/setup-micromamba@v1
with:
init-shell: bash
environment-file: ./.github/environment.yml
environment-name: "build"
cache-environment: true
cache-downloads: true
- name: Setup
shell: bash -l {0}
run: |
mkdir build
working-directory: ./libgeotiff
- name: CMake
shell: bash -l {0}
env:
BUILD_SHARED_LIBS: ${{ matrix.shared }}
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
export CC=cl.exe
export CXX=cl.exe
fi
cmake -G "Ninja" \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS \
-DBUILD_TESTING=ON \
-DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} \
-DWITH_ZLIB=ON \
-DWITH_JPEG=ON \
-DWITH_TIFF=ON \
-DTIFF_NAMES=tiff \
-DPROJ_NAMES=proj \
-DJPEG_NAMES=libjpeg \
..
working-directory: ./libgeotiff/build
- name: Compile
shell: bash -l {0}
run: |
ninja
working-directory: ./libgeotiff/build
- name: Generate source distribution
shell: bash -l {0}
if: matrix.os == 'ubuntu-latest'
run: |
cmake --build . --config Release --target package_source
extensions=".tar.gz .tar.bz2"
for ext in $extensions
do
for filename in $(ls *$ext)
do
`md5sum $filename > $filename.md5`
`sha256sum $filename > $filename.sha256sum`
`sha512sum $filename > $filename.sha512sum`
done
done
working-directory: ./libgeotiff/build
- name: Attest
uses: actions/attest-build-provenance@v1
if: matrix.os == 'ubuntu-latest' && matrix.shared == 'ON' && startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'OSGeo'
with:
subject-path: './libgeotiff/build/libgeotiff-*'
- uses: actions/upload-artifact@v4
if: matrix.os == 'ubuntu-latest' && matrix.shared == 'ON'
name: Gather source distribution artifact
with:
name: source-package-${{matrix.os}}
if-no-files-found: error
path: |
./libgeotiff/build/libgeotiff-*
release:
name: Gather and attach release
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
id-token: write
attestations: write
steps:
- uses: actions/download-artifact@v4
name: Download release artifact
with:
name: source-package-ubuntu-latest
path: release
- uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
name: Publish release as draft
with:
make_latest: false
fail_on_unmatched_files: true
prerelease: true
generate_release_notes: true
draft: true
files: |
release/libgeotiff-*