aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/release.yaml
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows/release.yaml')
-rw-r--r--.github/workflows/release.yaml265
1 files changed, 91 insertions, 174 deletions
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index a697c0071..8100c04ef 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -1,193 +1,110 @@
1name: release 1name: release
2on: 2on:
3 schedule:
4 - cron: '*/15 * * * *' # midnight UTC
5
3 push: 6 push:
4 branches: 7 branches:
5 - release 8 - release
6 9
7jobs: 10jobs:
8 build-server: 11 dist:
9 name: build-server 12 name: dist
10 runs-on: ${{ matrix.os }} 13 runs-on: ${{ matrix.os }}
11 strategy: 14 strategy:
12 matrix: 15 matrix:
13 os: [ubuntu-latest, windows-latest, macos-latest] 16 os: [ubuntu-latest, windows-latest, macos-latest]
17
14 env: 18 env:
15 RUSTFLAGS: -D warnings 19 RUSTFLAGS: -D warnings
16 CARGO_INCREMENTAL: 0 20 CARGO_INCREMENTAL: 0
17 RUSTUP_MAX_RETRIES: 10 21 RUSTUP_MAX_RETRIES: 10
18 CARGO_NET_RETRY: 10 22 CARGO_NET_RETRY: 10
19 steps:
20 23
21 - name: Checkout repository
22 uses: actions/checkout@v1
23
24 # We need to disable the existing toolchain to avoid updating rust-docs
25 # which takes a long time. The fastest way to do this is to rename the
26 # existing folder, as deleting it takes about as much time as not doing
27 # anything and just updating rust-docs.
28 - name: Rename existing rust toolchain (Windows)
29 if: matrix.os == 'windows-latest'
30 run: Rename-Item C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc.old
31
32 - name: Install Rust toolchain
33 uses: actions-rs/toolchain@v1
34 with:
35 toolchain: stable
36 profile: minimal
37 target: x86_64-unknown-linux-musl
38 override: true
39
40 - name: Build
41 if: matrix.os == 'ubuntu-latest'
42 uses: actions-rs/cargo@v1
43 env:
44 CC: clang
45 with:
46 command: build
47 args: --package rust-analyzer --bin rust-analyzer --release --target x86_64-unknown-linux-musl
48
49 - name: Build
50 if: matrix.os != 'ubuntu-latest'
51 uses: actions-rs/cargo@v1
52 with:
53 command: build
54 args: --package rust-analyzer --bin rust-analyzer --release
55
56 - name: Create distribution dir
57 run: mkdir ./dist
58
59 - name: Copy binary
60 if: matrix.os == 'ubuntu-latest'
61 run: cp ./target/x86_64-unknown-linux-musl/release/rust-analyzer ./dist/rust-analyzer-linux && strip ./dist/rust-analyzer-linux
62
63 - name: Copy binary
64 if: matrix.os == 'macos-latest'
65 run: cp ./target/release/rust-analyzer ./dist/rust-analyzer-mac
66
67 - name: Copy binary
68 if: matrix.os == 'windows-latest'
69 run: copy ./target/release/rust-analyzer.exe ./dist/rust-analyzer-windows.exe
70
71 - name: Upload artifacts
72 uses: actions/upload-artifact@v1
73 with:
74 name: server-${{ matrix.os }}
75 path: ./dist
76
77 build-clients:
78 name: build-clients
79 runs-on: ubuntu-latest
80 steps: 24 steps:
81 - name: Checkout repository 25 - name: Checkout repository
82 uses: actions/checkout@v1 26 uses: actions/checkout@v1
83 27
84 - name: Install Nodejs 28 # We need to disable the existing toolchain to avoid updating rust-docs
85 uses: actions/setup-node@v1 29 # which takes a long time. The fastest way to do this is to rename the
86 with: 30 # existing folder, as deleting it takes about as much time as not doing
87 node-version: 12.x 31 # anything and just updating rust-docs.
88 32 - name: Rename existing rust toolchain (Windows)
89 - run: npm ci 33 if: matrix.os == 'windows-latest'
90 working-directory: ./editors/code 34 run: Rename-Item C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc.old
91 35
92 - run: npm run package --scripts-prepend-node-path 36 - name: Install Rust toolchain
93 working-directory: ./editors/code 37 uses: actions-rs/toolchain@v1
94 38 with:
95 - name: Copy vscode extension 39 toolchain: stable
96 run: mkdir -p ./dist/code && cp ./editors/code/rust-analyzer.vsix ./dist/ 40 profile: minimal
97 41 target: x86_64-unknown-linux-musl
98 - name: Upload artifacts 42 override: true
99 uses: actions/upload-artifact@v1 43
100 with: 44 - name: Install Nodejs
101 name: editor-plugins 45 uses: actions/setup-node@v1
102 path: ./dist 46 with:
103 47 node-version: 12.x
104 make-release: 48
105 name: make-release 49 - name: Dist
50 if: github.event_name == 'push'
51 run: cargo xtask dist
52
53 - name: Dist
54 if: github.event_name != 'push'
55 run: cargo xtask dist --nightly
56
57 - name: Upload artifacts
58 uses: actions/upload-artifact@v1
59 with:
60 name: dist-${{ matrix.os }}
61 path: ./dist
62
63 publish:
64 name: publish
106 runs-on: ubuntu-latest 65 runs-on: ubuntu-latest
107 needs: ['build-server', 'build-clients'] 66 needs: ['dist']
108 steps: 67 steps:
109 - name: Install Nodejs 68 - name: Install Nodejs
110 uses: actions/setup-node@v1 69 uses: actions/setup-node@v1
111 with: 70 with:
112 node-version: 12.x 71 node-version: 12.x
113 72
114 - run: echo "::set-env name=TAG::$(date --iso)" 73 - run: echo "::set-env name=TAG::$(date --iso)"
115 - run: 'echo "TAG: $TAG"' 74 if: github.event_name == 'push'
116 75 - run: echo "::set-env name=TAG::nightly"
117 - name: Checkout repository 76 if: github.event_name == 'schedule'
118 uses: actions/checkout@v1 77 - run: 'echo "TAG: $TAG"'
119 78
120 - uses: actions/download-artifact@v1 79 - name: Checkout repository
121 with: 80 uses: actions/checkout@v1
122 name: editor-plugins 81
123 path: dist 82 - uses: actions/download-artifact@v1
124 - uses: actions/download-artifact@v1 83 with:
125 with: 84 name: dist-macos-latest
126 name: server-macos-latest 85 path: dist
127 path: dist 86 - uses: actions/download-artifact@v1
128 - uses: actions/download-artifact@v1 87 with:
129 with: 88 name: dist-ubuntu-latest
130 name: server-ubuntu-latest 89 path: dist
131 path: dist 90 - uses: actions/download-artifact@v1
132 - uses: actions/download-artifact@v1 91 with:
133 with: 92 name: dist-windows-latest
134 name: server-windows-latest 93 path: dist
135 path: dist 94 - run: ls -all ./dist
136 - run: ls -all ./dist 95
137 96 - name: Publish Release
138 - name: Create Release 97 uses: ./.github/actions/github-release
139 id: create_release 98 with:
140 # uses: actions/create-release@v1 99 files: "dist/*"
141 # https://github.com/actions/create-release/pull/32 100 name: ${{ env.TAG }}
142 uses: fleskesvor/create-release@1a72e235c178bf2ae6c51a8ae36febc24568c5fe 101 token: ${{ secrets.GITHUB_TOKEN }}
143 env: 102
144 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 103 - run: npm ci
145 with: 104 working-directory: ./editors/code
146 tag_name: ${{ env.TAG }} 105
147 release_name: ${{ env.TAG }} 106 - name: Publish Extension
148 draft: false 107 if: github.event_name == 'push'
149 prerelease: false 108 working-directory: ./editors/code
150 109 # token from https://dev.azure.com/rust-analyzer/
151 - uses: actions/[email protected] 110 run: npx vsce publish 0.1.$(date +%Y%m%d) --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer.vsix
152 env:
153 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
154 with:
155 upload_url: ${{ steps.create_release.outputs.upload_url }}
156 asset_path: ./dist/rust-analyzer-linux
157 asset_name: rust-analyzer-linux
158 asset_content_type: application/octet-stream
159
160 - uses: actions/[email protected]
161 env:
162 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
163 with:
164 upload_url: ${{ steps.create_release.outputs.upload_url }}
165 asset_path: ./dist/rust-analyzer-mac
166 asset_name: rust-analyzer-mac
167 asset_content_type: application/octet-stream
168
169 - uses: actions/[email protected]
170 env:
171 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
172 with:
173 upload_url: ${{ steps.create_release.outputs.upload_url }}
174 asset_path: ./dist/rust-analyzer-windows.exe
175 asset_name: rust-analyzer-windows.exe
176 asset_content_type: application/octet-stream
177
178 - uses: actions/[email protected]
179 env:
180 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
181 with:
182 upload_url: ${{ steps.create_release.outputs.upload_url }}
183 asset_path: ./dist/rust-analyzer.vsix
184 asset_name: rust-analyzer.vsix
185 asset_content_type: application/octet-stream
186
187 - run: npm ci
188 working-directory: ./editors/code
189
190 - name: Publish Extension
191 working-directory: ./editors/code
192 # token from https://dev.azure.com/rust-analyzer/
193 run: npx vsce publish 0.1.$(date +%Y%m%d) --pat ${{ secrets.MARKETPLACE_TOKEN }}