blob: 6784475b947f4204f69e5e2ed6bffd798e3715b1 [file] [log] [blame]
name: Build
on:
push:
branches: [main]
tags: ["v*.*.*"]
pull_request:
branches: [main]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- name: Install Python Dependencies
run: pip install --upgrade meson==0.60.2 ninja
- name: MSVC Setup
if: matrix.os == 'windows-latest'
uses: ilammy/msvc-dev-cmd@v1
- name: Meson Setup
run: meson --buildtype=release --strip -Ddebug=true --prefix="${{ github.workspace }}/dist" build
- name: Build
run: ninja -C build
- name: Test
run: ninja -C build test
- name: Install
if: github.ref_type == 'tag'
shell: bash
run: |
ninja -C build install
export VERSION=$(grep -m1 -o "version: '.*.'" meson.build | sed "s/version: '\(.*.\)'/\1/")
echo "ots_version=$VERSION" >> $GITHUB_ENV
mv -v dist/bin ots-$VERSION-${{ runner.os }}
- name: Archive
if: github.ref_type == 'tag'
uses: thedoctor0/zip-release@master
with:
path: ots-${{ env.ots_version }}-${{ runner.os }}
filename: ots-${{ env.ots_version }}-${{ runner.os }}.zip
- name: Upload
if: github.ref_type == 'tag'
uses: actions/upload-artifact@v2
with:
name: bin-${{ runner.os }}
path: ots-*.zip
if-no-files-found: error
- name: Make Dist Tarball
if: github.ref_type == 'tag' && matrix.os == 'ubuntu-latest'
run: meson dist -C build --no-tests
- name: Upload Dist Tarball
if: github.ref_type == 'tag' && matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v2
with:
name: dist
path: build/meson-dist/ots-*.tar.xz
if-no-files-found: error
deploy:
if: github.ref_type == 'tag'
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download artifacts from build jobs
uses: actions/download-artifact@v2
with:
path: dist
- name: Extract release notes from annotated tag message
run: |
# GH checkout action doesn't preserve tag annotations, we must fetch them
# https://github.com/actions/checkout/issues/290
git fetch --tags --force
echo "$(git tag -l --format='%(contents:body)' ${{ github.ref_name }})" > "${{ runner.temp }}/release_body.md"
echo "release_name=$(git tag -l --format='%(contents:subject)' ${{ github.ref_name }})" >> $GITHUB_ENV
- name: Publish
uses: softprops/action-gh-release@v1
with:
name: ${{ env.release_name }}
body_path: ${{ runner.temp }}/release_body.md
fail_on_unmatched_files: true
files: |
dist/*/*