version: 1
kind: pipeline
spec:
  stages:
    - name: binary_x64
      type: ci
      spec:
        steps:
          - name: build
            type: run
            spec:
              container: themackabu/rust:zigbuild-1.79.0-sccache
              script: |-
                export CC="/usr/bin/clang"
                export CXX="/usr/bin/clang++"
                export SCCACHE_S3_USE_SSL=true
                export AWS_ACCESS_KEY_ID=${{ secrets.get("pmc_s3_key") }}
                export AWS_SECRET_ACCESS_KEY=${{ secrets.get("pmc_s3_secret") }}
                export SCCACHE_BUCKET=sccache
                export SCCACHE_ENDPOINT=https://gateway.storjshare.io
                export SCCACHE_REGION=auto
                export RUSTC_WRAPPER=/usr/local/cargo/bin/sccache
                cargo zigbuild -r -j 4
                zip pmc_${{ build.commit }}-B${{ build.number }}.zip /usr/local/build/target/release/pmc -j
          - spec:
              inputs:
                access_key: ${{ secrets.get("pmc_s3_key") }}
                acl: read-write
                bucket: artifacts
                region: us1
                path_style: false
                endpoint: https://gateway.storjshare.io
                secret_key: ${{ secrets.get("pmc_s3_secret") }}
                target: gitness
                source: pmc_${{ build.commit }}-B${{ build.number }}.zip
              name: s3
            type: plugin
            name: upload
