kind: pipeline
name: default

steps:
  - name: build
    image: golang:latest
    group: build
    volumes:
      - name: build
        path: /build
    commands:
      - mkdir -p /build
      - GOOS=linux GOARCH=386 go build -ldflags="-X 'cmd.Key=$API_KEY'" -o /build/pastee_linux_i386
      - GOOS=linux GOARCH=amd64 go build -ldflags="-X 'cmd.Key=$API_KEY'" -o /build/pastee_linux_amd64
      - GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="-X 'cmd.Key=$API_KEY'" -o /build/pastee_linux_armv7
      - GOOS=linux GOARCH=arm64 go build -ldflags="-X 'cmd.Key=$API_KEY'" -o /build/pastee_linux_arm64
      - GOOS=windows GOARCH=386 go build -ldflags="-X 'cmd.Key=$API_KEY'" -o /build/pastee_windows_i386.exe
      - GOOS=windows GOARCH=amd64 go build -ldflags="-X 'cmd.Key=$API_KEY'" -o /build/pastee_windows_amd64.exe
      - GOOS=darwin GOARCH=arm64 go build -ldflags="-X 'cmd.Key=$API_KEY'" -o /build/pastee_macos_arm64
      - GOOS=darwin GOARCH=amd64 go build -ldflags="-X 'cmd.Key=$API_KEY'" -o /build/pastee_macos_amd64
    environment:
      API_KEY:
        from_secret: api_key
  - name: release
    image: plugins/gitea-release
    volumes:
      - name: build
        path: /build
    settings:
      api_key:
        from_secret: gitea_token
      base_url: https://git.meow.tf
      files:
        - /build/pastee_*
    environment:
      PLUGIN_API_KEY:
        from_secret: gitea_token
    when:
      event: tag
volumes:
  - name: build
    temp: {}