fit2gpx 0.6.1

.fit to .gpx converter
Documentation
name: Automatic trigger draft release on tag push

on:
  push:
    tags:
      - "v*.*.*"
  workflow_dispatch:

jobs:
  call-check-build:
    uses: ./.github/workflows/check-build.yml

  auto-release:
    runs-on: ubuntu-latest
    if: github.ref_type == 'tag'
    needs: call-check-build
    steps:
      - uses: actions/checkout@v4

      - name: Download prebuilt binary artifacts
        uses: actions/download-artifact@v4
        with:
          path: artifacts

      - name: List all downloaded artifacts
        run: ls -lARh artifacts

      - name: Prepare artifacts, tar, sha
        run: |
          set -e # exit on errors

          cd artifacts
          echo "pwd: '$(pwd)'"

          # Loop through each artifact subdirectory
          for platform in $(ls); do
            echo "working on: '$platform'"
            cd "$platform" # NOTE: needed for tar & sha256sum

            bin_path="$(ls)" # WARN: errors if more
            echo "binary found: '$bin_path'"
            tar_path="$platform.tar.gz"
            echo "tarring up..."; tar -czvf "$platform.tar.gz" "$bin_path"
            echo "hashing..."; sha256sum "$tar_path" > "$tar_path.sha256"

            mv *.tar.gz *.sha256 .. # the files we need
            cd .. # $platform/..
            rm -r "$platform" # remove the now-empty subdirectory
          done
          cd .. # artifacts/..

          mkdir -p target # should be present, so just in case
          mv artifacts target/release-binaries # target is in .gitignore, cargo publish won't cry

          ls -lARh target/release-binaries # beautiful!

      - name: Create a GitHub release
        uses: softprops/action-gh-release@v2
        with:
          # draft: true
          generate_release_notes: true
          files: target/release-binaries/*
          prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }}

      - name: Publish to crates.io
        shell: bash
        run: |
          version="v$(grep version Cargo.toml | head -n1 | cut -d '"' -f2)"
          git_tag="$(basename ${{ github.ref }})"
          echo "Cargo.toml version is: '$version', github tag is: '$git_tag'"
          if [ "$version" != "$git_tag" ]; then
            echo "error: they don't match!"; exit 1
          fi
          cargo publish --token "${{ secrets.CRATESIO_TOKEN }}" --verbose