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