fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1name: upload 2 3on: 4 push: 5 release: 6 types: [created] 7 workflow_dispatch: 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 19 target: x86_64-unknown-linux-gnu 20 - build: macos-x86_64 21 os: macos-latest 22 rust: nightly 23 target: x86_64-apple-darwin 24 - build: windows-x86_64-gnu 25 os: windows-latest 26 rust: nightly-x86_64-gnu 27 target: x86_64-pc-windows-gnu 28 - build: windows-x86_64-msvc 29 os: windows-latest 30 rust: nightly-x86_64-msvc 31 target: x86_64-pc-windows-msvc 32 runs-on: ${{ matrix.os }} 33 steps: 34 - uses: actions/checkout@v3 35 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 }} 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 48 - name: Build release binaries 49 run: cargo build --release 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 70 if: github.event_name == 'release' 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