Rust #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
workflow_dispatch: | |
inputs: | |
rust_version: | |
description: "Version of Rust to recompress." | |
type: string | |
required: true | |
github_tag: | |
description: "Tag to upload the release to." | |
type: string | |
required: true | |
env: | |
XZ_OPT: "-T0" | |
name: Rust | |
jobs: | |
recompress_rust: | |
name: Recompress Rust | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
strategy: | |
matrix: | |
target: [ | |
"x86_64-unknown-linux-gnu", | |
"aarch64-unknown-linux-gnu", | |
"x86_64-apple-darwin", | |
"aarch64-apple-darwin", | |
] | |
component: [ | |
"rustc", | |
"rust-std", | |
"cargo", | |
"clippy", | |
"rustfmt", | |
"llvm-tools", | |
"rustc-dev" | |
] | |
steps: | |
- name: Download Rust Components | |
run: | | |
mkdir downloads | |
mkdir artifacts | |
component=${{ matrix.component }} | |
target=${{ matrix.target }} | |
version=${{ inputs.rust_version }} | |
cd downloads | |
if [[ $version =~ ^(nightly|beta) ]]; then | |
IFS='/' read -r channel date <<< "$version" | |
export full_name="$component-$channel-$target" | |
export url_prefix=https://static.rust-lang.org/dist/$date | |
else | |
echo "STABLE" | |
export full_name="$component-$version-$target" | |
export url_prefix=https://static.rust-lang.org/dist | |
fi | |
xz_name="$full_name.tar.xz" | |
wget "$url_prefix/$xz_name" | |
tar -xJf $xz_name | |
tar -cf - $full_name | zstd --ultra -22 -o "../artifacts/$full_name.tar.zst" | |
- name: Determine Release Tag | |
run: | | |
RELEASE_TAG="rust-${{ inputs.rust_version }}" | |
if [ -n "${{ inputs.github_tag }}" ]; then | |
RELEASE_TAG="${{ inputs.github_tag }}" | |
fi | |
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV | |
- name: Upload zstd Compressed Artifacts to Release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
file: "artifacts/*.tar.zst" | |
file_glob: true | |
tag: ${{ env.RELEASE_TAG }} | |
overwrite: true |