name: build-shotcut-macos-unstable

on:
  workflow_dispatch:
  schedule:
    # nightly
    - cron: '0 12 * * *'

jobs:
  build:
    if: ${{ github.repository_owner == 'mltframework' }}
    runs-on: ubuntu-latest
    steps:
      - name: Download from S3
        run: |
          VERSION=$(date +"UNSTABLE-%y.%-m.%-d")
          echo VERSION=$VERSION
          sudo apt install -yqq s3cmd
          s3cmd --access_key=${{ secrets.AWS_ACCESS_KEY }} --secret_key=${{ secrets.AWS_SECRET_KEY }} --stop-on-error get s3://builds.us.meltytech/shotcut-build-macos-unstable.txt
          s3cmd --access_key=${{ secrets.AWS_ACCESS_KEY }} --secret_key=${{ secrets.AWS_SECRET_KEY }} --stop-on-error get s3://builds.us.meltytech/shotcut/shotcut-macos-unsigned-$VERSION.dmg

      - name: Upload artifacts
        uses: actions/upload-artifact@v4
        with:
          name: unsigned-dmg
          path: |
            *.dmg

      - name: Dump log
        run: cat shotcut-build-macos-unstable.txt
