Skip to content

Rust

Rust #9

Workflow file for this run

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
outputs:
filename: ${{ steps.download.outputs.filename }}
checksum: ${{ steps.download.outputs.checksum }}
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu # linux
- aarch64-unknown-linux-gnu # linux arm
- x86_64-apple-darwin # apple intel
- aarch64-apple-darwin # apple m-series
- x86_64-pc-windows-msvc # windows
- aarch64-pc-windows-msvc # windows arm
component:
- "rustc"
- "cargo"
- "rustfmt"
- "rust-std"
- "clippy"
- "llvm-tools"
- "rustc-dev"
include:
- target: "wasm32-unknown-unknown"
component: "rust-std"
- component: "rust-src"
steps:
- name: Download Rust Component
id: download
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}"
version="${channel}"
url_prefix=https://static.rust-lang.org/dist/$date
else
echo "STABLE"
url_prefix=https://static.rust-lang.org/dist
fi
if [[ -n "${target}" ]]; then
full_name="${component}-${version}-${target}"
else
full_name="${component}-${version}"
fi
xz_name="${full_name}.tar.xz"
wget "${url_prefix}/${xz_name}"
tar -xJf "${xz_name}"
output_file="../artifacts/${full_name}.tar.zst"
tar -cf - "${full_name}" | zstd --ultra -22 -o "${output_file}"
echo "filename=${full_name}" >> $GITHUB_OUTPUT
echo "checksum=$(sha256sum "$output_file")"
- name: Upload zstd Compressed Artifacts to Release
uses: svenstaro/upload-release-action@v2
with:
file: "artifacts/*.tar.zst"
file_glob: true
tag: ${{ inputs.github_tag }}
overwrite: true
upload-checksum:
needs: [recompress_rust]
name: Upload a checksum file
runs-on: ubuntu-latest
steps:
- name: Transform needs outputs
run: |
echo '${{ toJSON(needs) }}' | jq 'to_entries | map(.value.outputs | {(.name): .checksum}) | add' > ${{ inputs.rust_version }}-checksums.json
- name: Upload zstd Compressed Artifacts to Release
uses: svenstaro/upload-release-action@v2
with:
file: "${{ inputs.rust_version }}-checksums.json"
tag: ${{ inputs.github_tag }}
overwrite: true