]> git.lizzy.rs Git - rust.git/blob - .github/workflows/release.yaml
Use older ubuntu for releases
[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-16.04, 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         override: true
43
44     - name: Install Nodejs
45       if: matrix.os == 'ubuntu-16.04'
46       uses: actions/setup-node@v1
47       with:
48         node-version: 12.x
49
50     - name: Dist
51       if: matrix.os == 'ubuntu-16.04' && github.ref == 'refs/heads/release'
52       run: cargo xtask dist --client 0.2.$GITHUB_RUN_NUMBER
53
54     - name: Dist
55       if: matrix.os == 'ubuntu-16.04' && github.ref != 'refs/heads/release'
56       run: cargo xtask dist --nightly --client 0.3.$GITHUB_RUN_NUMBER-nightly
57
58     - name: Dist
59       if: matrix.os != 'ubuntu-16.04'
60       run: cargo xtask dist
61
62     - name: Nightly analysis-stats check
63       if: matrix.os == 'ubuntu-16.04' && github.ref != 'refs/heads/release'
64       run: ./dist/rust-analyzer-linux analysis-stats .
65
66     - name: Upload artifacts
67       uses: actions/upload-artifact@v1
68       with:
69         name: dist-${{ matrix.os }}
70         path: ./dist
71
72   publish:
73     name: publish
74     runs-on: ubuntu-16.04
75     needs: ['dist']
76     steps:
77     - name: Install Nodejs
78       uses: actions/setup-node@v1
79       with:
80         node-version: 12.x
81
82     - run: echo "::set-env name=TAG::$(date --iso --utc)"
83       if: github.ref == 'refs/heads/release'
84     - run: echo "::set-env name=TAG::nightly"
85       if: github.ref != 'refs/heads/release'
86     - run: 'echo "TAG: $TAG"'
87
88     - name: Checkout repository
89       uses: actions/checkout@v2
90
91     - uses: actions/download-artifact@v1
92       with:
93         name: dist-macos-latest
94         path: dist
95     - uses: actions/download-artifact@v1
96       with:
97         name: dist-ubuntu-16.04
98         path: dist
99     - uses: actions/download-artifact@v1
100       with:
101         name: dist-windows-latest
102         path: dist
103     - run: ls -all ./dist
104
105     - name: Publish Release
106       uses: ./.github/actions/github-release
107       with:
108         files: "dist/*"
109         name: ${{ env.TAG }}
110         token: ${{ secrets.GITHUB_TOKEN }}
111
112     - run: npm ci
113       working-directory: ./editors/code
114
115     - name: Publish Extension
116       if: github.ref == 'refs/heads/release'
117       working-directory: ./editors/code
118       # token from https://dev.azure.com/rust-analyzer/
119       run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer.vsix