14 build: [linux-x86_64, macos-x86_64, windows-x86_64-gnu, windows-x86_64-msvc]
19 target: x86_64-unknown-linux-gnu
23 target: x86_64-apple-darwin
24 - build: windows-x86_64-gnu
26 rust: nightly-x86_64-gnu
27 target: x86_64-pc-windows-gnu
28 - build: windows-x86_64-msvc
30 rust: nightly-x86_64-msvc
31 target: x86_64-pc-windows-msvc
32 runs-on: ${{ matrix.os }}
34 - uses: actions/checkout@v3
37 - name: install rustup
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 }}
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'
48 - name: Build release binaries
49 uses: actions-rs/cargo@v1
57 staging="rustfmt_${{ matrix.build }}_${{ github.event.release.tag_name }}"
60 cp {README.md,Configurations.md,CHANGELOG.md,LICENSE-MIT,LICENSE-APACHE} "$staging/"
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
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
72 - name: Upload Release Asset
73 if: github.event_name == 'release'
74 uses: actions/upload-release-asset@v1
76 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78 upload_url: ${{ github.event.release.upload_url }}
79 asset_path: ${{ env.ASSET }}
80 asset_name: ${{ env.ASSET }}
81 asset_content_type: application/octet-stream