]> git.lizzy.rs Git - rust.git/blob - src/tools/rustfmt/.github/workflows/upload-assets.yml
Add 'src/tools/rustfmt/' from commit '7872306edf2e11a69aaffb9434088fd66b46a863'
[rust.git] / src / tools / rustfmt / .github / workflows / upload-assets.yml
1 name: upload
2
3 on:
4   release:
5     types: [created]
6
7 jobs:
8   build-release:
9     name: build-release
10     strategy:
11       matrix:
12         build: [linux-x86_64, macos-x86_64, windows-x86_64-gnu, windows-x86_64-msvc]
13         include:
14           - build: linux-x86_64
15             os: ubuntu-latest
16             rust: nightly
17           - build: macos-x86_64
18             os: macos-latest
19             rust: nightly
20           - build: windows-x86_64-gnu
21             os: windows-latest
22             rust: nightly-x86_64-gnu
23           - build: windows-x86_64-msvc
24             os: windows-latest
25             rust: nightly-x86_64-msvc
26     runs-on: ${{ matrix.os }}
27     steps:
28       - uses: actions/checkout@v2
29
30       - name: Install Rust
31         uses: actions-rs/toolchain@v1
32         with:
33           profile: minimal
34           toolchain: ${{ matrix.rust }}
35           override: true
36
37       - name: Add mingw64 to path for x86_64-gnu
38         run: echo "C:\msys64\mingw64\bin" >> $GITHUB_PATH
39         if: matrix.rust == 'nightly-x86_64-gnu'
40         shell: bash
41
42       - name: Install cargo-make
43         uses: actions-rs/cargo@v1
44         with:
45           command: install
46           args: --force cargo-make
47
48       - name: Build release binaries
49         uses: actions-rs/cargo@v1
50         with:
51           command: make
52           args: release
53
54       - name: Build archive
55         shell: bash
56         run: |
57           staging="rustfmt_${{ matrix.build }}_${{ github.event.release.tag_name }}"
58           mkdir -p "$staging"
59
60           cp {README.md,Configurations.md,CHANGELOG.md,LICENSE-MIT,LICENSE-APACHE} "$staging/"
61
62           if [ "${{ matrix.os }}" = "windows-latest" ]; then
63             cp target/release/{rustfmt.exe,cargo-fmt.exe,rustfmt-format-diff.exe,git-rustfmt.exe} "$staging/"
64             7z a "$staging.zip" "$staging"
65             echo "ASSET=$staging.zip" >> $GITHUB_ENV
66           else
67             cp target/release/{rustfmt,cargo-fmt,rustfmt-format-diff,git-rustfmt} "$staging/"
68             tar czf "$staging.tar.gz" "$staging"
69             echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
70           fi
71
72       - name: Upload Release Asset
73         uses: actions/upload-release-asset@v1
74         env:
75           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76         with:
77           upload_url: ${{ github.event.release.upload_url }}
78           asset_path: ${{ env.ASSET }}
79           asset_name: ${{ env.ASSET }}
80           asset_content_type: application/octet-stream