|
| 1 | +# https://github.com/rust-lang/rust-analyzer/blob/aa00ddcf654a35ba0eafe17247cf189958d33182/.github/workflows/release.yaml |
| 2 | + |
| 3 | +name: Release |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + |
| 7 | + # temp |
| 8 | +# push: |
| 9 | +# branches: |
| 10 | +# - lsp |
| 11 | + |
| 12 | +env: |
| 13 | + CARGO_INCREMENTAL: 0 |
| 14 | + CARGO_NET_RETRY: 10 |
| 15 | + RUSTUP_MAX_RETRIES: 10 |
| 16 | + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc |
| 17 | + CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc |
| 18 | + # should match with version in dist.rs |
| 19 | + VERSION_STABLE: 0.2 |
| 20 | + |
| 21 | +# for git tagging |
| 22 | +permissions: |
| 23 | + contents: write |
| 24 | + |
| 25 | +jobs: |
| 26 | + dist: |
| 27 | + strategy: |
| 28 | + fail-fast: false |
| 29 | + matrix: |
| 30 | + include: |
| 31 | + - os: windows-latest |
| 32 | + target: x86_64-pc-windows-msvc |
| 33 | + code-target: win32-x64 |
| 34 | + - os: windows-latest |
| 35 | + target: i686-pc-windows-msvc |
| 36 | + - os: windows-latest |
| 37 | + target: aarch64-pc-windows-msvc |
| 38 | + code-target: win32-arm64 |
| 39 | + - os: ubuntu-20.04 |
| 40 | + target: x86_64-unknown-linux-gnu |
| 41 | + code-target: linux-x64 |
| 42 | + container: rockylinux:8 |
| 43 | + - os: ubuntu-20.04 |
| 44 | + target: aarch64-unknown-linux-gnu |
| 45 | + code-target: linux-arm64 |
| 46 | + - os: ubuntu-20.04 |
| 47 | + target: arm-unknown-linux-gnueabihf |
| 48 | + code-target: linux-armhf |
| 49 | + - os: macos-12 |
| 50 | + target: x86_64-apple-darwin |
| 51 | + code-target: darwin-x64 |
| 52 | + - os: macos-12 |
| 53 | + target: aarch64-apple-darwin |
| 54 | + code-target: darwin-arm64 |
| 55 | + |
| 56 | + runs-on: ${{ matrix.os }} |
| 57 | + name: dist (${{ matrix.target }}) |
| 58 | + container: ${{ matrix.container }} |
| 59 | + |
| 60 | + env: |
| 61 | + FLB_LS_TARGET: ${{ matrix.target }} |
| 62 | + |
| 63 | + steps: |
| 64 | + - uses: actions/checkout@v4 |
| 65 | + - name: Install toolchain dependencies |
| 66 | + if: matrix.container == 'rockylinux:8' |
| 67 | + shell: bash |
| 68 | + run: | |
| 69 | + dnf install -y clang |
| 70 | + curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL "https://sh.rustup.rs" | sh -s -- --profile minimal --default-toolchain none -y |
| 71 | + echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH |
| 72 | +
|
| 73 | + - name: Install Rust toolchain |
| 74 | + run: | |
| 75 | + rustup update --no-self-update stable |
| 76 | + rustup target add ${{ matrix.target }} |
| 77 | + rustup component add rust-src |
| 78 | +
|
| 79 | + - name: Update apt repositories |
| 80 | + if: matrix.target == 'aarch64-unknown-linux-gnu' || matrix.target == 'arm-unknown-linux-gnueabihf' |
| 81 | + run: | |
| 82 | + sudo apt-get update |
| 83 | + sudo apt-get install clang gcc-multilib |
| 84 | +
|
| 85 | + - name: Install AArch64 target toolchain |
| 86 | + if: matrix.target == 'aarch64-unknown-linux-gnu' |
| 87 | + run: sudo apt-get install gcc-aarch64-linux-gnu |
| 88 | + |
| 89 | + - name: Install ARM target toolchain |
| 90 | + if: matrix.target == 'arm-unknown-linux-gnueabihf' |
| 91 | + run: sudo apt-get install gcc-arm-linux-gnueabihf |
| 92 | + |
| 93 | + - name: Dist |
| 94 | + run: cargo xtask dist --client-patch-version ${{ github.run_number }} |
| 95 | + |
| 96 | + - uses: pnpm/action-setup@v4 |
| 97 | + with: |
| 98 | + package_json_file: clients/vscode/package.json |
| 99 | + run_install: false |
| 100 | + |
| 101 | + - uses: actions/setup-node@v4 |
| 102 | + with: |
| 103 | + node-version: 20 |
| 104 | + cache: 'pnpm' |
| 105 | + cache-dependency-path: clients/vscode/pnpm-lock.yaml |
| 106 | + |
| 107 | + - run: pnpm install |
| 108 | + working-directory: clients/vscode |
| 109 | + |
| 110 | + - name: Package Extension |
| 111 | + if: matrix.code-target |
| 112 | + run: pnpm dlx vsce package -o "../../dist/vscode-fluent-bit-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }} --no-dependencies |
| 113 | + working-directory: clients/vscode |
| 114 | + |
| 115 | + # XXX: I don't think no-server version is needed for now. |
| 116 | + |
| 117 | + - name: Upload artifacts |
| 118 | + uses: actions/upload-artifact@v4 |
| 119 | + with: |
| 120 | + name: dist-${{ matrix.target }} |
| 121 | + path: ./dist |
| 122 | + |
| 123 | + dist-x86_64-unknown-linux-musl: |
| 124 | + name: dist (x86_64-unknown-linux-musl) |
| 125 | + runs-on: ubuntu-latest |
| 126 | + env: |
| 127 | + FLB_LS_TARGET: x86_64-unknown-linux-musl |
| 128 | + # For some reason `-crt-static` is not working for clang without lld |
| 129 | + RUSTFLAGS: "-C link-arg=-fuse-ld=lld -C target-feature=-crt-static" |
| 130 | + container: |
| 131 | + image: rust:alpine |
| 132 | + volumes: |
| 133 | + - /usr/local/cargo/registry:/usr/local/cargo/registry |
| 134 | + |
| 135 | + steps: |
| 136 | + - name: Install dependencies |
| 137 | + run: apk add --no-cache git clang lld musl-dev nodejs npm tar |
| 138 | + |
| 139 | + - uses: actions/checkout@v4 |
| 140 | + |
| 141 | + - name: Dist |
| 142 | + run: cargo xtask dist --client-patch-version ${{ github.run_number }} |
| 143 | + |
| 144 | + - uses: pnpm/action-setup@v4 |
| 145 | + with: |
| 146 | + package_json_file: clients/vscode/package.json |
| 147 | + run_install: false |
| 148 | + |
| 149 | + - uses: actions/setup-node@v4 |
| 150 | + with: |
| 151 | + node-version: 20 |
| 152 | + cache: 'pnpm' |
| 153 | + cache-dependency-path: clients/vscode/pnpm-lock.yaml |
| 154 | + |
| 155 | + - run: pnpm install |
| 156 | + working-directory: clients/vscode |
| 157 | + |
| 158 | + - name: Package Extension |
| 159 | + run: pnpm dlx vsce package -o "../../dist/vscode-fluent-bit-alpine-x64.vsix" --target alpine-x64 --no-dependencies |
| 160 | + working-directory: clients/vscode |
| 161 | + |
| 162 | + - run: rm -rf clients/vscode/server |
| 163 | + |
| 164 | + - name: Upload artifacts |
| 165 | + uses: actions/upload-artifact@v4 |
| 166 | + with: |
| 167 | + name: dist-x86_64-unknown-linux-musl |
| 168 | + path: ./dist |
| 169 | + |
| 170 | + publish: |
| 171 | + name: publish |
| 172 | + runs-on: ubuntu-latest |
| 173 | + needs: [ "dist", "dist-x86_64-unknown-linux-musl" ] |
| 174 | + steps: |
| 175 | + - uses: actions/checkout@v4 |
| 176 | + - uses: actions/setup-node@v4 |
| 177 | + with: |
| 178 | + node-version: 20 |
| 179 | + |
| 180 | + - run: echo "TAG=${{ env.VERSION_STABLE }}.${{ github.run_number }}" >> $GITHUB_ENV |
| 181 | + - run: 'echo "TAG: $TAG"' |
| 182 | + |
| 183 | + - uses: actions/download-artifact@v4 |
| 184 | + with: |
| 185 | + name: dist-aarch64-apple-darwin |
| 186 | + path: dist |
| 187 | + - uses: actions/download-artifact@v4 |
| 188 | + with: |
| 189 | + name: dist-x86_64-apple-darwin |
| 190 | + path: dist |
| 191 | + - uses: actions/download-artifact@v4 |
| 192 | + with: |
| 193 | + name: dist-x86_64-unknown-linux-gnu |
| 194 | + path: dist |
| 195 | + - uses: actions/download-artifact@v4 |
| 196 | + with: |
| 197 | + name: dist-x86_64-unknown-linux-musl |
| 198 | + path: dist |
| 199 | + - uses: actions/download-artifact@v4 |
| 200 | + with: |
| 201 | + name: dist-aarch64-unknown-linux-gnu |
| 202 | + path: dist |
| 203 | + - uses: actions/download-artifact@v4 |
| 204 | + with: |
| 205 | + name: dist-arm-unknown-linux-gnueabihf |
| 206 | + path: dist |
| 207 | + - uses: actions/download-artifact@v4 |
| 208 | + with: |
| 209 | + name: dist-x86_64-pc-windows-msvc |
| 210 | + path: dist |
| 211 | + - uses: actions/download-artifact@v4 |
| 212 | + with: |
| 213 | + name: dist-i686-pc-windows-msvc |
| 214 | + path: dist |
| 215 | + - uses: actions/download-artifact@v4 |
| 216 | + with: |
| 217 | + name: dist-aarch64-pc-windows-msvc |
| 218 | + path: dist |
| 219 | + |
| 220 | + - run: ls -al ./dist |
| 221 | + |
| 222 | + - name: git tag and push |
| 223 | + run: | |
| 224 | + git config user.name 'github-actions[bot]' |
| 225 | + git config user.email 'github-actions[bot]@users.noreply.github.com' |
| 226 | + git tag -a $TAG -m "Release $TAG" |
| 227 | + git push origin $TAG |
| 228 | +
|
| 229 | + - name: Publish release |
| 230 | + uses: softprops/action-gh-release@v2 |
| 231 | + with: |
| 232 | + name: ${{ env.TAG }} |
| 233 | + tag_name: ${{ env.TAG }} |
| 234 | + files: | |
| 235 | + dist/* |
| 236 | +
|
| 237 | + - uses: pnpm/action-setup@v4 |
| 238 | + with: |
| 239 | + package_json_file: clients/vscode/package.json |
| 240 | + run_install: false |
| 241 | + |
| 242 | + - uses: actions/setup-node@v4 |
| 243 | + with: |
| 244 | + node-version: 20 |
| 245 | + cache: 'pnpm' |
| 246 | + cache-dependency-path: clients/vscode/pnpm-lock.yaml |
| 247 | + |
| 248 | + - run: pnpm install |
| 249 | + working-directory: clients/vscode |
| 250 | + |
| 251 | + - name: Publish Extension (Code Marketplace) |
| 252 | + run: pnpm dlx vsce publish --pat ${{ secrets.VSCE_TOKEN }} --packagePath ../../dist/vscode-fluent-bit-*.vsix |
| 253 | + working-directory: clients/vscode |
| 254 | + |
| 255 | + - name: Publish Extension (OpenVSX) |
| 256 | + run: pnpm dlx ovsx publish --pat ${{ secrets.OVSX_TOKEN }} --packagePath ../../dist/vscode-fluent-bit-*.vsix |
| 257 | + working-directory: clients/vscode |
| 258 | + timeout-minutes: 2 |
0 commit comments