summaryrefslogtreecommitdiffstats
path: root/.github/workflows/cd.yml
blob: eb44669798c479ffae26bf71fc3e681535372a43 (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
63
64
name: Publish

on:
  push:
    tags:
      - '*'

jobs:

  alfred:
    name: Publish Alfred workflow
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - name: Zip
      run: scripts/action workflow
    - name: Get the version
      id: get_version
      run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
    - name: Upload workflow to release
      uses: svenstaro/upload-release-action@v1-release
      with:
        repo_token: ${{ secrets.GITHUB_TOKEN }}
        file: target/workflow/navi.zip
        tag: ${{ github.ref }}
        asset_name: navi-${{ steps.get_version.outputs.VERSION }}.alfredworkflow

  binary:
    name: Publish binary for ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        # This should work with only the `include`s but it currently doesn't because of this bug:
        # https://github.community/t5/How-to-use-Git-and-GitHub/GitHub-Actions-Matrix-options-dont-work-as-documented/td-p/29558
        target: [x86_64-osx, x86_64-unknown-linux-musl, armv7-unknown-linux-musleabihf, armv7-linux-androideabi, aarch64-linux-android]
        include:
          - os: macos-latest
            target: x86_64-osx
          - os: ubuntu-latest
            target: x86_64-unknown-linux-musl
          - os: ubuntu-latest
            target: armv7-unknown-linux-musleabihf
          - os: ubuntu-latest
            target: armv7-linux-androideabi
          - os: ubuntu-latest
            target: aarch64-linux-android

    steps:
    - uses: hecrj/setup-rust-action@v1.3.1
      with:
        rust-version: stable
    - uses: actions/checkout@v1
    - name: Build
      run: scripts/action release ${{ matrix.target }}
    - name: Get the version
      id: get_version
      run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
    - name: Upload binaries to release
      uses: svenstaro/upload-release-action@v1-release
      with:
        repo_token: ${{ secrets.GITHUB_TOKEN }}
        file: target/tar/navi.tar.gz
        tag: ${{ github.ref }}
        asset_name: navi-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }}.tar.gz