Rust #8
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 | |
runner: | |
description: "Type of runner to use/architecture to build for." | |
type: choice | |
options: | |
- toolchains-ubuntu-22.04-x86 | |
- toolchains-ubuntu-22.04-arm | |
github_tag: | |
description: "Tag to upload the release to." | |
type: string | |
required: false | |
env: | |
XZ_OPT: "-T0" | |
name: Rust | |
jobs: | |
recompress_rust: | |
name: Recompress Rust | |
runs-on: ${{ inputs.runner }} | |
permissions: | |
contents: write | |
strategy: | |
matrix: | |
target: ["x86_64-unknown-linux-gnu"] | |
steps: | |
- name: Download Rust Components | |
run: | | |
mkdir downloads | |
mkdir artifacts | |
components=("rustc") | |
target=${{ matrix.target }} | |
version=${{ inputs.rust_version }} | |
cd downloads | |
for component in "${components[@]}"; do | |
full_name="$component-$version-$target" | |
xz_name="$full_name.tar.xz" | |
wget https://static.rust-lang.org/dist/$xz_name | |
tar -xJf $xz_name | |
tar -cf - $full_name | zstd --ultra -22 -o "../artifacts/$full_name.tar.zst" | |
done | |
- 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: Save zstd Compressed Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: rust-toolchains | |
path: "artifacts/*.tar.zst" | |
- 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 |