]> git.lizzy.rs Git - rust.git/blob - .github/workflows/release.yaml
Merge #3630
[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
10 jobs:
11   dist:
12     name: dist
13     runs-on: ${{ matrix.os }}
14     strategy:
15       matrix:
16         os: [ubuntu-latest, windows-latest, macos-latest]
17
18     env:
19       RUSTFLAGS: -D warnings
20       CARGO_INCREMENTAL: 0
21       RUSTUP_MAX_RETRIES: 10
22       CARGO_NET_RETRY: 10
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 (Windows)
33       if: matrix.os == 'windows-latest'
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
35
36     - name: Install Rust toolchain
37       uses: actions-rs/toolchain@v1
38       with:
39         toolchain: stable
40         profile: minimal
41         target: x86_64-unknown-linux-musl
42         override: true
43
44     - name: Install Nodejs
45       if: matrix.os == 'ubuntu-latest'
46       uses: actions/setup-node@v1
47       with:
48         node-version: 12.x
49
50     - name: Dist
51       if: github.event_name == 'push'
52       run: cargo xtask dist
53
54     - name: Dist
55       if: github.event_name != 'push'
56       run: cargo xtask dist --nightly
57
58     - name: Upload artifacts
59       uses: actions/upload-artifact@v1
60       with:
61         name: dist-${{ matrix.os }}
62         path: ./dist
63
64   publish:
65     name: publish
66     runs-on: ubuntu-latest
67     needs: ['dist']
68     steps:
69     - name: Install Nodejs
70       uses: actions/setup-node@v1
71       with:
72         node-version: 12.x
73
74     - run: echo "::set-env name=TAG::$(date --iso --utc)"
75       if: github.event_name == 'push'
76     - run: echo "::set-env name=TAG::nightly"
77       if: github.event_name == 'schedule'
78     - run: 'echo "TAG: $TAG"'
79
80     - name: Checkout repository
81       uses: actions/checkout@v2
82
83     - uses: actions/download-artifact@v1
84       with:
85         name: dist-macos-latest
86         path: dist
87     - uses: actions/download-artifact@v1
88       with:
89         name: dist-ubuntu-latest
90         path: dist
91     - uses: actions/download-artifact@v1
92       with:
93         name: dist-windows-latest
94         path: dist
95     - run: ls -all ./dist
96
97     - name: Publish Release
98       uses: ./.github/actions/github-release
99       with:
100         files: "dist/*"
101         name: ${{ env.TAG }}
102         token: ${{ secrets.GITHUB_TOKEN }}
103
104     - run: npm ci
105       working-directory: ./editors/code
106
107     - name: Publish Extension
108       if: github.event_name == 'push'
109       working-directory: ./editors/code
110       # token from https://dev.azure.com/rust-analyzer/
111       run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer.vsix