summaryrefslogtreecommitdiff
path: root/mut/neovim/pack/plugins/start/blink.cmp/.github/workflows/release.yaml
blob: b2d643d677edff857eb791a93ea80d2b47e87648 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Release

on:
  push:
    tags:
      - "v*"

jobs:
  build:
    name: Build ${{ matrix.target }}
    runs-on: ${{ matrix.os }}
    permissions:
      contents: read
    strategy:
      matrix:
        include:
          ## Linux builds
          # Glibc 2.31
          - os: ubuntu-20.04
            target: x86_64-unknown-linux-gnu
            artifact_name: target/x86_64-unknown-linux-gnu/release/libblink_cmp_fuzzy.so
          - os: ubuntu-20.04
            target: aarch64-unknown-linux-gnu
            artifact_name: target/aarch64-unknown-linux-gnu/release/libblink_cmp_fuzzy.so
          # Musl 1.2.3
          - os: ubuntu-latest
            target: x86_64-unknown-linux-musl
            artifact_name: target/x86_64-unknown-linux-musl/release/libblink_cmp_fuzzy.so
          - os: ubuntu-latest
            target: aarch64-unknown-linux-musl
            artifact_name: target/aarch64-unknown-linux-musl/release/libblink_cmp_fuzzy.so
          # Android(Termux)
          - os: ubuntu-latest
            target: aarch64-linux-android
            artifact_name: target/aarch64-linux-android/release/libblink_cmp_fuzzy.so

          ## macOS builds
          - os: macos-latest
            target: x86_64-apple-darwin
            artifact_name: target/x86_64-apple-darwin/release/libblink_cmp_fuzzy.dylib
          - os: macos-latest
            target: aarch64-apple-darwin
            artifact_name: target/aarch64-apple-darwin/release/libblink_cmp_fuzzy.dylib

          ## Windows builds
          - os: windows-latest
            target: x86_64-pc-windows-msvc
            artifact_name: target/x86_64-pc-windows-msvc/release/blink_cmp_fuzzy.dll

    steps:
      - uses: actions/checkout@v4

      - name: Install Rust
        run: |
          rustup toolchain install nightly
          rustup default nightly
          rustup target add ${{ matrix.target }}

      - name: Build for Linux
        if: contains(matrix.os, 'ubuntu')
        run: |
          cargo install cross --git https://github.com/cross-rs/cross
          cross build --release --target ${{ matrix.target }}
          mv "${{ matrix.artifact_name }}" "${{ matrix.target }}.so"

      - name: Build for macOS
        if: contains(matrix.os, 'macos')
        run: |
          # Ventura (https://en.wikipedia.org/wiki/MacOS_version_history#Releases)
          MACOSX_DEPLOYMENT_TARGET="13" cargo build --release --target ${{ matrix.target }}
          mv "${{ matrix.artifact_name }}" "${{ matrix.target }}.dylib"

      - name: Build for Windows
        if: contains(matrix.os, 'windows')
        run: |
          cargo build --release --target ${{ matrix.target }}
          mv "${{ matrix.artifact_name }}" "${{ matrix.target }}.dll"

      - name: Upload artifacts
        uses: actions/upload-artifact@v4
        with:
          name: ${{ matrix.target }}
          path: ${{ matrix.target }}.*

  release:
    name: Release
    needs: build
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - name: Download artifacts
        uses: actions/download-artifact@v4

      - name: Generate checksums
        run: |
          for file in ./**/*; do
            sha256sum "$file" > "${file}.sha256"
          done

      - name: Upload Release Assets
        uses: softprops/action-gh-release@v2
        with:
          name: ${{ github.ref_name }}
          tag_name: ${{ github.ref_name }}
          token: ${{ github.token }}
          files: ./**/*
          draft: false
          prerelease: false
          generate_release_notes: true

  deploy-docs:
    name: Deploy docs
    runs-on: ubuntu-latest
    permissions:
      contents: read
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4

      - name: Build
        run: npm ci && npm run build:release
        working-directory: docs

      - name: Deploy
        uses: cloudflare/wrangler-action@v3
        with:
          apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
          accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
          command: pages deploy docs/.vitepress/dist --project-name=blink-cmp