name: Build Binaries
permissions:
  contents: read
on:
  workflow_dispatch:
  push:
    tags:
      - '[0-9]+.[0-9]+.[0-9]+'
  pull_request:
    branches: [ main ]
    paths:
      - '.github/workflows/build_binaries.yml'
      - 'Makefile'
      - 'go.mod'
      - 'go.sum'
      - '**.go'
jobs:
  build:
    name: Build
    if: github.repository_owner == 'miniflux'
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
      - name: Set up Golang
        uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
        with:
          go-version: stable
          check-latest: true
      - name: Compile binaries
        env:
          CGO_ENABLED: 0
        run: make build
      - name: Upload binaries
        if: github.event_name != 'pull_request'
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: binaries
          path: miniflux-*
          if-no-files-found: error
          retention-days: 5
