]> git.lizzy.rs Git - rust.git/blob - .github/workflows/release.yaml
Run analysis-stats nightly
[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     - nightly
10
11 env:
12   CARGO_INCREMENTAL: 0
13   CARGO_NET_RETRY: 10
14   RUSTFLAGS: -D warnings
15   RUSTUP_MAX_RETRIES: 10
16
17 jobs:
18   dist:
19     name: dist
20     runs-on: ${{ matrix.os }}
21     strategy:
22       matrix:
23         os: [ubuntu-latest, windows-latest, macos-latest]
24
25     steps:
26     - name: Checkout repository
27       uses: actions/checkout@v2
28
29     # We need to disable the existing toolchain to avoid updating rust-docs
30     # which takes a long time. The fastest way to do this is to rename the
31     # existing folder, as deleting it takes about as much time as not doing
32     # anything and just updating rust-docs.
33     - name: Rename existing rust toolchain (Windows)
34       if: matrix.os == 'windows-latest'
35       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
36
37     - name: Install Rust toolchain
38       uses: actions-rs/toolchain@v1
39       with:
40         toolchain: stable
41         profile: minimal
42         target: x86_64-unknown-linux-musl
43         override: true
44
45     - name: Install Nodejs
46       if: matrix.os == 'ubuntu-latest'
47       uses: actions/setup-node@v1
48       with:
49         node-version: 12.x
50
51     - name: Dist
52       if: matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/release'
53       run: cargo xtask dist --client --version 0.2.$GITHUB_RUN_NUMBER         --tag $(date --iso --utc)
54
55     - name: Dist
56       if: matrix.os == 'ubuntu-latest' && github.ref != 'refs/heads/release'
57       run: cargo xtask dist --client --version 0.3.$GITHUB_RUN_NUMBER-nightly --tag nightly
58
59     - name: Dist
60       if: matrix.os != 'ubuntu-latest'
61       run: cargo xtask dist
62
63     - name: Nightly analysis-stats check
64       if: matrix.os == 'ubuntu-latest' && if: github.ref != 'refs/heads/release'
65       run: ./dist/rust-analyzer analysis-stats .
66
67     - name: Upload artifacts
68       uses: actions/upload-artifact@v1
69       with:
70         name: dist-${{ matrix.os }}
71         path: ./dist
72
73   publish:
74     name: publish
75     runs-on: ubuntu-latest
76     needs: ['dist']
77     steps:
78     - name: Install Nodejs
79       uses: actions/setup-node@v1
80       with:
81         node-version: 12.x
82
83     - run: echo "::set-env name=TAG::$(date --iso --utc)"
84       if: github.ref == 'refs/heads/release'
85     - run: echo "::set-env name=TAG::nightly"
86       if: github.ref != 'refs/heads/release'
87     - run: 'echo "TAG: $TAG"'
88
89     - name: Checkout repository
90       uses: actions/checkout@v2
91
92     - uses: actions/download-artifact@v1
93       with:
94         name: dist-macos-latest
95         path: dist
96     - uses: actions/download-artifact@v1
97       with:
98         name: dist-ubuntu-latest
99         path: dist
100     - uses: actions/download-artifact@v1
101       with:
102         name: dist-windows-latest
103         path: dist
104     - run: ls -all ./dist
105
106     - name: Publish Release
107       uses: ./.github/actions/github-release
108       with:
109         files: "dist/*"
110         name: ${{ env.TAG }}
111         token: ${{ secrets.GITHUB_TOKEN }}
112
113     - run: npm ci
114       working-directory: ./editors/code
115
116     - name: Publish Extension
117       if: github.ref == 'refs/heads/release'
118       working-directory: ./editors/code
119       # token from https://dev.azure.com/rust-analyzer/
120       run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer.vsix