name: Release Build

on:
  push:
    tags:
      - v*

jobs:
  build:
    runs-on: macos
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Setup Go
        uses: actions/setup-go@v2
        with:
          go-version: 1.24
      - name: Installing Wails
        run: |
          go install github.com/wailsapp/wails/v2/cmd/wails@latest
      - name: Running Wails doctor
        run: |
          wails doctor
      - name: Installing Dependencies
        run: |
          npm install
      - name: Build
        run: |
          wails build -clean -platform darwin/arm64 -ldflags "-X main.VersionNumber=`git describe --tags --abbrev=0`"
      - name: Release
        uses: https://lmika.dev/actions/wails-release@v1.0.4
        with:
          developer-id-cert-base64: ${{ secrets.MACOS_SIGN_P12 }}
          developer-id-cert-password: ${{ secrets.MACOS_SIGN_PASSWORD }}
          notarization-api-key-base64: ${{ secrets.MACOS_NOTARY_KEY }}
          notarization-api-key-id: ${{ secrets.MACOS_NOTARY_KEY_ID }}
          notarization-api-issuer-id: ${{ secrets.MACOS_NOTARY_ISSUER_ID }}
          extra-build-flags: -ldflags "-X main.VersionNumber=${{ github.ref_name }}"
          s3-bucket: lmika-public-files
          s3-key: 'Apps/Dequoter/{version}/{filename},Apps/Dequoter/latest/{filename}'
          s3-region: ap-southeast-2
          s3-acl: public-read
        env:
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_S3_PUBLISH_ACCESS_KEY }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_S3_PUBLISH_SECRET_KEY }}