rusnel 0.11.2

Rusnel is a fast TCP/UDP tunnel, transported over and encrypted using QUIC protocol. Single executable including both client and server
Documentation
name: Release

on:
  push:
    tags: ["v*"]
  workflow_dispatch:
    inputs:
      tag:
        description: "Release tag (e.g. v0.5.0). Must already exist."
        required: true

permissions:
  contents: write
  packages: write

jobs:
  create-release:
    name: Create GitHub release
    runs-on: ubuntu-latest
    outputs:
      tag: ${{ steps.resolve.outputs.tag }}
    steps:
      - uses: actions/checkout@v4

      - name: Resolve tag
        id: resolve
        run: |
          if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
            echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
          else
            echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
          fi

      - name: Create release (idempotent)
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          tag="${{ steps.resolve.outputs.tag }}"
          if ! gh release view "$tag" >/dev/null 2>&1; then
            gh release create "$tag" \
              --title "$tag" \
              --generate-notes
          fi

  upload-binaries:
    name: ${{ matrix.target }}
    needs: create-release
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - target: x86_64-unknown-linux-gnu
            os: ubuntu-latest
          - target: x86_64-unknown-linux-musl
            os: ubuntu-latest
          - target: aarch64-unknown-linux-musl
            os: ubuntu-latest
          - target: x86_64-apple-darwin
            os: macos-latest
          - target: aarch64-apple-darwin
            os: macos-latest
          - target: x86_64-pc-windows-msvc
            os: windows-latest
    steps:
      - uses: actions/checkout@v4
        with:
          ref: ${{ needs.create-release.outputs.tag }}

      - name: Upload binary to release
        uses: taiki-e/upload-rust-binary-action@v1
        with:
          bin: rusnel
          target: ${{ matrix.target }}
          ref: refs/tags/${{ needs.create-release.outputs.tag }}
          archive: rusnel-$tag-$target
          checksum: sha256
          token: ${{ secrets.GITHUB_TOKEN }}

  docker:
    name: Docker image (ghcr.io)
    needs: create-release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          ref: ${{ needs.create-release.outputs.tag }}

      - uses: docker/setup-qemu-action@v3
      - uses: docker/setup-buildx-action@v3

      - name: Log in to GHCR
        uses: docker/login-action@v3
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - name: Image metadata
        id: meta
        uses: docker/metadata-action@v5
        with:
          images: ghcr.io/${{ github.repository_owner }}/rusnel
          tags: |
            type=semver,pattern={{version}},value=${{ needs.create-release.outputs.tag }}
            type=semver,pattern={{major}}.{{minor}},value=${{ needs.create-release.outputs.tag }}
            type=raw,value=latest

      - name: Build & push
        uses: docker/build-push-action@v5
        with:
          context: .
          platforms: linux/amd64,linux/arm64
          push: true
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}
          cache-from: type=gha
          cache-to: type=gha,mode=max