]> git.proxmox.com Git - rustc.git/blame - src/tools/rustfmt/.github/workflows/upload-assets.yml
New upstream version 1.72.1+dfsg1
[rustc.git] / src / tools / rustfmt / .github / workflows / upload-assets.yml
CommitLineData
f20569fa
XL
1name: upload
2
3on:
3c0e092e 4 push:
f20569fa
XL
5 release:
6 types: [created]
3c0e092e 7 workflow_dispatch:
f20569fa
XL
8
9jobs:
10 build-release:
11 name: build-release
12 strategy:
13 matrix:
14 build: [linux-x86_64, macos-x86_64, windows-x86_64-gnu, windows-x86_64-msvc]
15 include:
16 - build: linux-x86_64
17 os: ubuntu-latest
18 rust: nightly
3c0e092e 19 target: x86_64-unknown-linux-gnu
f20569fa
XL
20 - build: macos-x86_64
21 os: macos-latest
22 rust: nightly
3c0e092e 23 target: x86_64-apple-darwin
f20569fa
XL
24 - build: windows-x86_64-gnu
25 os: windows-latest
26 rust: nightly-x86_64-gnu
3c0e092e 27 target: x86_64-pc-windows-gnu
f20569fa
XL
28 - build: windows-x86_64-msvc
29 os: windows-latest
30 rust: nightly-x86_64-msvc
3c0e092e 31 target: x86_64-pc-windows-msvc
f20569fa
XL
32 runs-on: ${{ matrix.os }}
33 steps:
923072b8 34 - uses: actions/checkout@v3
f20569fa 35
3c0e092e
XL
36 # Run build
37 - name: install rustup
38 run: |
39 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup-init.sh
40 sh rustup-init.sh -y --default-toolchain none
41 rustup target add ${{ matrix.target }}
f20569fa
XL
42
43 - name: Add mingw64 to path for x86_64-gnu
44 run: echo "C:\msys64\mingw64\bin" >> $GITHUB_PATH
45 if: matrix.rust == 'nightly-x86_64-gnu'
46 shell: bash
47
f20569fa 48 - name: Build release binaries
fe692bf9 49 run: cargo build --release
f20569fa
XL
50
51 - name: Build archive
52 shell: bash
53 run: |
54 staging="rustfmt_${{ matrix.build }}_${{ github.event.release.tag_name }}"
55 mkdir -p "$staging"
56
57 cp {README.md,Configurations.md,CHANGELOG.md,LICENSE-MIT,LICENSE-APACHE} "$staging/"
58
59 if [ "${{ matrix.os }}" = "windows-latest" ]; then
60 cp target/release/{rustfmt.exe,cargo-fmt.exe,rustfmt-format-diff.exe,git-rustfmt.exe} "$staging/"
61 7z a "$staging.zip" "$staging"
62 echo "ASSET=$staging.zip" >> $GITHUB_ENV
63 else
64 cp target/release/{rustfmt,cargo-fmt,rustfmt-format-diff,git-rustfmt} "$staging/"
65 tar czf "$staging.tar.gz" "$staging"
66 echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
67 fi
68
69 - name: Upload Release Asset
3c0e092e 70 if: github.event_name == 'release'
f20569fa
XL
71 uses: actions/upload-release-asset@v1
72 env:
73 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74 with:
75 upload_url: ${{ github.event.release.upload_url }}
76 asset_path: ${{ env.ASSET }}
77 asset_name: ${{ env.ASSET }}
78 asset_content_type: application/octet-stream