]> git.lizzy.rs Git - rust.git/blob - .github/workflows/release.yaml
fix release more
[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 jobs:
12   dist:
13     name: dist
14     runs-on: ${{ matrix.os }}
15     strategy:
16       matrix:
17         os: [ubuntu-latest, windows-latest, macos-latest]
18
19     env:
20       RUSTFLAGS: -D warnings
21       CARGO_INCREMENTAL: 0
22       RUSTUP_MAX_RETRIES: 10
23       CARGO_NET_RETRY: 10
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: Upload artifacts
64       uses: actions/upload-artifact@v1
65       with:
66         name: dist-${{ matrix.os }}
67         path: ./dist
68
69   publish:
70     name: publish
71     runs-on: ubuntu-latest
72     needs: ['dist']
73     steps:
74     - name: Install Nodejs
75       uses: actions/setup-node@v1
76       with:
77         node-version: 12.x
78
79     - run: echo "::set-env name=TAG::$(date --iso --utc)"
80       if: github.ref == 'refs/heads/release'
81     - run: echo "::set-env name=TAG::nightly"
82       if: github.ref != 'refs/heads/release'
83     - run: 'echo "TAG: $TAG"'
84
85     - name: Checkout repository
86       uses: actions/checkout@v2
87
88     - uses: actions/download-artifact@v1
89       with:
90         name: dist-macos-latest
91         path: dist
92     - uses: actions/download-artifact@v1
93       with:
94         name: dist-ubuntu-latest
95         path: dist
96     - uses: actions/download-artifact@v1
97       with:
98         name: dist-windows-latest
99         path: dist
100     - run: ls -all ./dist
101
102     - name: Publish Release
103       uses: ./.github/actions/github-release
104       with:
105         files: "dist/*"
106         name: ${{ env.TAG }}
107         token: ${{ secrets.GITHUB_TOKEN }}
108
109     - run: npm ci
110       working-directory: ./editors/code
111
112     - name: Publish Extension
113       if: github.ref == 'refs/heads/release'
114       working-directory: ./editors/code
115       # token from https://dev.azure.com/rust-analyzer/
116       run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer.vsix