2020-09-23 22:22:37 -05:00
|
|
|
name: upload
|
|
|
|
|
|
|
|
on:
|
2021-10-13 21:41:50 -05:00
|
|
|
push:
|
2020-09-23 22:22:37 -05:00
|
|
|
release:
|
|
|
|
types: [created]
|
2021-10-13 21:41:50 -05:00
|
|
|
workflow_dispatch:
|
2020-09-23 22:22:37 -05:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-release:
|
|
|
|
name: build-release
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-02-02 22:54:12 -06:00
|
|
|
build: [linux-x86_64, macos-x86_64, windows-x86_64-gnu, windows-x86_64-msvc]
|
2020-09-23 22:22:37 -05:00
|
|
|
include:
|
2021-02-02 22:54:12 -06:00
|
|
|
- build: linux-x86_64
|
2020-09-23 22:22:37 -05:00
|
|
|
os: ubuntu-latest
|
|
|
|
rust: nightly
|
2021-10-13 21:41:50 -05:00
|
|
|
target: x86_64-unknown-linux-gnu
|
2021-02-02 22:54:12 -06:00
|
|
|
- build: macos-x86_64
|
2020-09-23 22:22:37 -05:00
|
|
|
os: macos-latest
|
|
|
|
rust: nightly
|
2021-10-13 21:41:50 -05:00
|
|
|
target: x86_64-apple-darwin
|
2021-02-02 22:54:12 -06:00
|
|
|
- build: windows-x86_64-gnu
|
2020-09-23 22:22:37 -05:00
|
|
|
os: windows-latest
|
|
|
|
rust: nightly-x86_64-gnu
|
2021-10-13 21:41:50 -05:00
|
|
|
target: x86_64-pc-windows-gnu
|
2021-02-02 22:54:12 -06:00
|
|
|
- build: windows-x86_64-msvc
|
2020-09-23 22:22:37 -05:00
|
|
|
os: windows-latest
|
|
|
|
rust: nightly-x86_64-msvc
|
2021-10-13 21:41:50 -05:00
|
|
|
target: x86_64-pc-windows-msvc
|
2020-09-23 22:22:37 -05:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
2024-09-09 08:51:19 -05:00
|
|
|
- uses: actions/checkout@v4
|
2020-09-23 22:22:37 -05:00
|
|
|
|
2021-10-13 21:41:50 -05:00
|
|
|
# Run build
|
|
|
|
- name: install rustup
|
|
|
|
run: |
|
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup-init.sh
|
|
|
|
sh rustup-init.sh -y --default-toolchain none
|
|
|
|
rustup target add ${{ matrix.target }}
|
2020-09-23 22:22:37 -05:00
|
|
|
|
2021-01-09 12:45:08 -06:00
|
|
|
- name: Add mingw64 to path for x86_64-gnu
|
|
|
|
run: echo "C:\msys64\mingw64\bin" >> $GITHUB_PATH
|
|
|
|
if: matrix.rust == 'nightly-x86_64-gnu'
|
|
|
|
shell: bash
|
|
|
|
|
2020-09-23 22:22:37 -05:00
|
|
|
- name: Build release binaries
|
2023-01-29 16:45:26 -06:00
|
|
|
run: cargo build --release
|
2020-09-23 22:22:37 -05:00
|
|
|
|
|
|
|
- name: Build archive
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
staging="rustfmt_${{ matrix.build }}_${{ github.event.release.tag_name }}"
|
|
|
|
mkdir -p "$staging"
|
|
|
|
|
|
|
|
cp {README.md,Configurations.md,CHANGELOG.md,LICENSE-MIT,LICENSE-APACHE} "$staging/"
|
|
|
|
|
|
|
|
if [ "${{ matrix.os }}" = "windows-latest" ]; then
|
2020-10-30 00:37:08 -05:00
|
|
|
cp target/release/{rustfmt.exe,cargo-fmt.exe,rustfmt-format-diff.exe,git-rustfmt.exe} "$staging/"
|
2020-09-23 22:22:37 -05:00
|
|
|
7z a "$staging.zip" "$staging"
|
2020-11-16 13:24:51 -06:00
|
|
|
echo "ASSET=$staging.zip" >> $GITHUB_ENV
|
2020-09-23 22:22:37 -05:00
|
|
|
else
|
2020-10-30 00:37:08 -05:00
|
|
|
cp target/release/{rustfmt,cargo-fmt,rustfmt-format-diff,git-rustfmt} "$staging/"
|
2020-09-23 22:22:37 -05:00
|
|
|
tar czf "$staging.tar.gz" "$staging"
|
2020-11-16 13:24:51 -06:00
|
|
|
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
|
2020-09-23 22:22:37 -05:00
|
|
|
fi
|
|
|
|
|
|
|
|
- name: Upload Release Asset
|
2021-10-13 21:41:50 -05:00
|
|
|
if: github.event_name == 'release'
|
2020-09-23 22:22:37 -05:00
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
upload_url: ${{ github.event.release.upload_url }}
|
|
|
|
asset_path: ${{ env.ASSET }}
|
|
|
|
asset_name: ${{ env.ASSET }}
|
|
|
|
asset_content_type: application/octet-stream
|