name: Build and Release

on:
  push:
    tags:
      - 'v*.*.*'

jobs:
  build:
    runs-on: ubuntu-latest

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

      - name: Build binary
        run: |
          mkdir -p release/
          docker build -t podman-compose-bin -v "$PWD/release:/result" .
          mv "$PWD/release/podman-compose" "$PWD/release/podman-compose-linux-x86"

      - name: Upload release asset
        uses: softprops/action-gh-release@v2
        with:
          files: ./release/podman-compose-linux-x86
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
