]> git.lizzy.rs Git - rust.git/blob - .github/workflows/release.yaml
Merge pull request #3461 from matklad/dist
[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   build-server:
12     name: build-server
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@v1
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: Dist
45       if: github.event_name == 'push'
46       run: cargo xtask dist
47
48     - name: Dist
49       if: github.event_name != 'push'
50       run: cargo xtask dist --nightly
51
52     - name: Upload artifacts
53       uses: actions/upload-artifact@v1
54       with:
55         name: dist-${{ matrix.os }}
56         path: ./dist
57
58   make-release:
59     name: make-release
60     runs-on: ubuntu-latest
61     needs: ['build-server', 'build-clients']
62     steps:
63     - name: Install Nodejs
64       uses: actions/setup-node@v1
65       with:
66         node-version: 12.x
67
68     - run: echo "::set-env name=TAG::$(date --iso)"
69       if: github.event_name == 'push'
70     - run: echo "::set-env name=TAG::nightly"
71       if: github.event_name != 'push'
72     - run: 'echo "TAG: $TAG"'
73
74     - name: Checkout repository
75       uses: actions/checkout@v1
76
77     - uses: actions/download-artifact@v1
78       with:
79         name: dist-macos-latest
80         path: dist
81     - uses: actions/download-artifact@v1
82       with:
83         name: dist-ubuntu-latest
84         path: dist
85     - uses: actions/download-artifact@v1
86       with:
87         name: dist-windows-latest
88         path: dist
89     - run: ls -all ./dist
90
91     - name: Publish Release
92       uses: ./.github/actions/github-release
93       with:
94         files: "dist/*"
95         name: ${{ env.TAG }}
96         token: ${{ secrets.GITHUB_TOKEN }}
97
98     - run: npm ci
99       working-directory: ./editors/code
100
101     - name: Publish Extension
102       if: github.event_name == 'push'
103       working-directory: ./editors/code
104       # token from https://dev.azure.com/rust-analyzer/
105       run: npx vsce publish 0.1.$(date +%Y%m%d) --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer.vsix