flute 1.11.0

File Delivery over Unidirectional Transport (FLUTE)
Documentation
name: Release

on:
  workflow_dispatch:

env:
  CARGO_TERM_COLOR: always

permissions:
  contents: write
  packages: write

jobs:
  release:
    name: Create a new Release
    runs-on: ubuntu-latest
    steps:

      - name: Checkout code
        uses: actions/checkout@v4

      - name: Set up environment variables
        run: |
          VERSION="$(gh release list --json isDraft,tagName --jq 'map(select(.isDraft == true)) | .[0].tagName')"
          VERSION="${VERSION#v}"
          echo "VERSION=$VERSION" >> $GITHUB_ENV
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Set up Rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable

      - name: Install cargo-set-version
        run: cargo install cargo-set-version

      - name: Install xmllint
        run: |
          sudo apt update
          sudo apt-get install -y libxml2-utils

      - name: Run Tests
        uses: actions-rs/cargo@v1
        with:
          command: test

      - name: Bump to new version 
        run: |
          cargo set-version ${VERSION}
          cargo generate-lockfile
          git config user.name "${{ github.actor }}"
          git config user.email "${{ github.actor }}@users.noreply.github.com"
          git commit Cargo.toml  -m "Bump to version ${VERSION}"
          git tag -a v${VERSION} -m "Release version $VERSION"
        env:  
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Push changes and tag
        run: |
          git push origin main v${VERSION}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Publish release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: gh release edit v${{ env.VERSION }} --draft=false

      - name: Repository Dispatch
        uses: peter-evans/repository-dispatch@v3
        with:
          event-type: release