]> git.lizzy.rs Git - rust.git/blob - .github/workflows/release.yaml
Merge #7110
[rust.git] / .github / workflows / release.yaml
1 name: release
2 on:
3   schedule:
4   - cron: '0 0 * * *' # midnight UTC
5
6   push:
7     branches:
8     - release
9     - trigger-nightly
10
11 env:
12   CARGO_INCREMENTAL: 0
13   CARGO_NET_RETRY: 10
14   RUSTFLAGS: "-D warnings -W unreachable-pub"
15   RUSTUP_MAX_RETRIES: 10
16
17 jobs:
18   dist-x86_64-pc-windows-msvc:
19     name: dist (x86_64-pc-windows-msvc)
20     runs-on: windows-latest
21     env:
22       RA_TARGET: x86_64-pc-windows-msvc
23
24     steps:
25     - name: Checkout repository
26       uses: actions/checkout@v2
27
28     # We need to disable the existing toolchain to avoid updating rust-docs
29     # which takes a long time. The fastest way to do this is to rename the
30     # existing folder, as deleting it takes about as much time as not doing
31     # anything and just updating rust-docs.
32     - name: Rename existing rust toolchain
33       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
34
35     - name: Install Rust toolchain
36       uses: actions-rs/toolchain@v1
37       with:
38         toolchain: stable
39         profile: minimal
40         override: true
41
42     - name: Dist
43       run: cargo xtask dist
44
45     - name: Upload artifacts
46       uses: actions/upload-artifact@v1
47       with:
48         name: dist-x86_64-pc-windows-msvc
49         path: ./dist
50
51   dist-aarch64-pc-windows-msvc:
52     name: dist (aarch64-pc-windows-msvc)
53     runs-on: windows-latest
54     env:
55       RA_TARGET: aarch64-pc-windows-msvc
56
57     steps:
58     - name: Checkout repository
59       uses: actions/checkout@v2
60
61     - name: Rename existing rust toolchain
62       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
63
64     - name: Install Rust toolchain
65       uses: actions-rs/toolchain@v1
66       with:
67         toolchain: stable
68         target: aarch64-pc-windows-msvc
69         profile: minimal
70         override: true
71
72     - name: Dist
73       run: cargo xtask dist
74
75     - name: Upload artifacts
76       uses: actions/upload-artifact@v1
77       with:
78         name: dist-aarch64-pc-windows-msvc
79         path: ./dist
80
81   dist-x86_64-unknown-linux-gnu:
82     name: dist (x86_64-unknown-linux-gnu)
83     runs-on: ubuntu-16.04
84     env:
85       RA_TARGET: x86_64-unknown-linux-gnu
86
87     steps:
88     - name: Checkout repository
89       uses: actions/checkout@v2
90
91     - name: Install Rust toolchain
92       uses: actions-rs/toolchain@v1
93       with:
94         toolchain: stable
95         profile: minimal
96         override: true
97
98     - name: Install Nodejs
99       uses: actions/setup-node@v1
100       with:
101         node-version: 12.x
102
103     - name: Dist
104       if: github.ref == 'refs/heads/release'
105       run: cargo xtask dist --client 0.2.$GITHUB_RUN_NUMBER
106
107     - name: Dist
108       if: github.ref != 'refs/heads/release'
109       run: cargo xtask dist --nightly --client 0.3.$GITHUB_RUN_NUMBER-nightly
110
111     - name: Nightly analysis-stats check
112       if: github.ref != 'refs/heads/release'
113       run: target/${{ env.RA_TARGET }}/release/rust-analyzer analysis-stats .
114
115     - name: Upload artifacts
116       uses: actions/upload-artifact@v1
117       with:
118         name: dist-x86_64-unknown-linux-gnu
119         path: ./dist
120
121   dist-x86_64-apple-darwin:
122     name: dist (x86_64-apple-darwin)
123     runs-on: macos-latest
124     env:
125       RA_TARGET: x86_64-apple-darwin
126
127     steps:
128     - name: Checkout repository
129       uses: actions/checkout@v2
130
131     - name: Install Rust toolchain
132       uses: actions-rs/toolchain@v1
133       with:
134         toolchain: stable
135         profile: minimal
136         override: true
137
138     - name: Dist
139       run: cargo xtask dist
140
141     - name: Upload artifacts
142       uses: actions/upload-artifact@v1
143       with:
144         name: dist-x86_64-apple-darwin
145         path: ./dist
146
147   dist-aarch64-apple-darwin:
148     name: dist (aarch64-apple-darwin)
149     runs-on: macos-latest
150     env:
151       RA_TARGET: aarch64-apple-darwin
152
153     steps:
154     - name: Checkout repository
155       uses: actions/checkout@v2
156
157     - name: Install Rust toolchain
158       uses: actions-rs/toolchain@v1
159       with:
160         toolchain: stable
161         target: aarch64-apple-darwin
162         profile: minimal
163         override: true
164
165     - name: Dist
166       run: SDKROOT=$(xcrun -sdk macosx11.0 --show-sdk-path) MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx11.0 --show-sdk-platform-version) cargo xtask dist
167
168     - name: Upload artifacts
169       uses: actions/upload-artifact@v1
170       with:
171         name: dist-aarch64-apple-darwin
172         path: ./dist
173
174   publish:
175     name: publish
176     runs-on: ubuntu-16.04
177     needs: ['dist-x86_64-pc-windows-msvc', 'dist-aarch64-pc-windows-msvc', 'dist-x86_64-unknown-linux-gnu', 'dist-x86_64-apple-darwin', 'dist-aarch64-apple-darwin']
178     steps:
179     - name: Install Nodejs
180       uses: actions/setup-node@v1
181       with:
182         node-version: 12.x
183
184     - run: echo "TAG=$(date --iso --utc)" >> $GITHUB_ENV
185       if: github.ref == 'refs/heads/release'
186     - run: echo "TAG=nightly" >> $GITHUB_ENV
187       if: github.ref != 'refs/heads/release'
188     - run: 'echo "TAG: $TAG"'
189
190     - name: Checkout repository
191       uses: actions/checkout@v2
192
193     - run: echo "HEAD_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
194     - run: 'echo "HEAD_SHA: $HEAD_SHA"'
195
196     - uses: actions/download-artifact@v1
197       with:
198         name: dist-aarch64-apple-darwin
199         path: dist
200     - uses: actions/download-artifact@v1
201       with:
202         name: dist-x86_64-apple-darwin
203         path: dist
204     - uses: actions/download-artifact@v1
205       with:
206         name: dist-x86_64-unknown-linux-gnu
207         path: dist
208     - uses: actions/download-artifact@v1
209       with:
210         name: dist-x86_64-pc-windows-msvc
211         path: dist
212     - uses: actions/download-artifact@v1
213       with:
214         name: dist-aarch64-pc-windows-msvc
215         path: dist
216     - run: ls -al ./dist
217
218     - name: Publish Release
219       uses: ./.github/actions/github-release
220       with:
221         files: "dist/*"
222         name: ${{ env.TAG }}
223         token: ${{ secrets.GITHUB_TOKEN }}
224
225     - run: npm ci
226       working-directory: ./editors/code
227
228     - name: Publish Extension
229       if: github.ref == 'refs/heads/release'
230       working-directory: ./editors/code
231       # token from https://dev.azure.com/rust-analyzer/
232       run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer.vsix