]> git.lizzy.rs Git - rust.git/blob - .github/workflows/release.yaml
Complicate
[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
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     - run: echo "::set-env name=HEAD_SHA::$(git rev-parse HEAD)"
92     - run: 'echo "HEAD_SHA: $HEAD_SHA"'
93
94     - uses: actions/download-artifact@v1
95       with:
96         name: dist-macos-latest
97         path: dist
98     - uses: actions/download-artifact@v1
99       with:
100         name: dist-ubuntu-16.04
101         path: dist
102     - uses: actions/download-artifact@v1
103       with:
104         name: dist-windows-latest
105         path: dist
106     - run: ls -all ./dist
107
108     - name: Publish Release
109       uses: ./.github/actions/github-release
110       with:
111         files: "dist/*"
112         name: ${{ env.TAG }}
113         token: ${{ secrets.GITHUB_TOKEN }}
114
115     - run: npm ci
116       working-directory: ./editors/code
117
118     - name: Publish Extension
119       if: github.ref == 'refs/heads/release'
120       working-directory: ./editors/code
121       # token from https://dev.azure.com/rust-analyzer/
122       run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer.vsix