cflare 0.2.0

Cloudflare command-line tool
Documentation
on: push

name: Build

env:
  GITHUB_REF: "${{ github.ref }}"
  WINDOWS_TARGET: x86_64-pc-windows-msvc
  MACOS_TARGET: x86_64-apple-darwin
  LINUX_TARGET: x86_64-unknown-linux-musl

  # Space separated paths to include in the archive.
  RELEASE_ADDS: README.md

jobs:
  build:
    name: Build artifacts
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        build: [linux, macos, windows]
        include:
          - build: linux
            os: ubuntu-latest
            rust: stable
          - build: macos
            os: macos-latest
            rust: stable
          - build: windows
            os: windows-latest
            rust: stable

    steps:
      - uses: actions/checkout@v2

      - name: Cache Cargo registry
        uses: actions/cache@v1
        if: matrix.rust
        with:
          path: ~/.cargo/registry
          key: ${{ matrix.build }}-stable-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            ${{ matrix.build }}-stable-cargo-registry-

      - name: Cache Cargo index
        uses: actions/cache@v1
        if: matrix.rust
        with:
          path: ~/.cargo/git
          key: ${{ matrix.build }}-stable-cargo-index-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            ${{ matrix.build }}-stable-cargo-index-

      - name: Cache Cargo build
        uses: actions/cache@v1
        if: matrix.rust
        with:
          path: target/release
          key: ${{ matrix.build }}-stable-release-target-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            ${{ matrix.build }}-stable-release-target-

      - name: Query version number
        id: get_version
        shell: bash
        run: |
          echo "using version tag ${GITHUB_REF:10}"
          echo ::set-output name=version::"${GITHUB_REF:10}"
      - name: Install Rust
        if: matrix.rust
        run: |
          rustup update ${{ matrix.rust }} --no-self-update
          rustup default ${{ matrix.rust }}

      - name: Install musl-tools (Linux)
        if: matrix.build == 'linux'
        run: |
          sudo apt-get update -y
          sudo apt-get install musl-tools -y

      - name: Build (Linux)
        if: matrix.build == 'linux'
        run: |
          sudo apt install libssl-dev
          rustup target add ${{ env.LINUX_TARGET }}
          cargo build --release --target ${{ env.LINUX_TARGET }}

      - name: Build (MacOS)
        if: matrix.build == 'macos'
        run: cargo build --release

      - name: Build (Windows)
        if: matrix.build == 'windows'
        run: cargo build --release
        env:
          RUSTFLAGS: -Ctarget-feature=+crt-static