libdivecomputer-sys 0.1.0

Unsafe bindings for libdivecomputer
Documentation
name: Release

on:
  push:
    tags: 'v*'

jobs:
  release:
    name: Release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Version number
        id: version
        run: |
          VERSION="${GITHUB_REF/refs\/tags\/v/}"
          echo "version=${VERSION}" >> $GITHUB_OUTPUT

      - name: Build distribution tarball
        id: build
        run: |
          sudo apt-get install libbluetooth-dev libusb-1.0-0-dev
          autoreconf --install --force
          ./configure
          make
          make distcheck

      - name: Check tarball version number
        id: check
        run: |
          FILENAME="libdivecomputer-${{ steps.version.outputs.version }}.tar.gz"
          if [ ! -f "${FILENAME}" ]; then
             echo ::error ::Tarball \'${FILENAME}\' not found!
             exit 1
          fi

      - name: Create Github release
        id: release
        run: |
          VERSION="${{ steps.version.outputs.version }}"
          if [ "${VERSION}" != "${VERSION%%-*}" ]; then
             PRERELEASE="-p"
          fi
          gh release create ${PRERELEASE} "${{ github.ref }}" "libdivecomputer-${VERSION}.tar.gz"
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}