summaryrefslogtreecommitdiff
path: root/.github/workflows/release.yml
blob: 4b999e98d4c8fcedef069a0778f115d266160a4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Release

on:
  push:
    tags:
      - "*"

jobs:
  build:
    name: Build
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [macOS-latest, windows-latest, ubuntu-latest]
        include:
          - os: macOS-latest
            archive: tar
            output: streamlib-${{ github.sha }}-x86_64-apple-darwin.tar.gz
            content_type: 'application/gzip'
          - os: windows-latest
            archive: zip
            output: streamlib-${{ github.sha }}-x86_64-pc-windows-msvc.zip
            content_type: application/zip
          - os: ubuntu-latest
            archive: tar
            output: streamlib-${{ github.sha }}-x86_64-unknown-linux-gnu.tar.gz
            content_type: application/gzip

    steps:
      - name: Checkout
        uses: actions/checkout@v1

      - name: Install toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable

      - name: Build
        run: cargo build --verbose --release

      - name: Test
        run: cargo test --verbose

      - name: Build ZIP
        id: build_zip
        if: matrix.archive == 'zip'
        run: |
          cp target/release/foo.exe .
          7z a ${{ matrix.output }} foo.exe

      - name: Build TAR
        id: build_tar
        if: matrix.archive == 'tar'
        run: |
          cp target/release/foo .
          tar czvf ${{ matrix.output }} foo

      - name: Upload
        uses: actions/upload-artifact@master
        with:
          name: ${{ matrix.output }}
          path: ${{ matrix.output }}