mbedtls v0.12.1 #27
Workflow file for this run
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
name: Publish Crates | |
on: | |
release: | |
types: [created] | |
workflow_dispatch: | |
inputs: | |
crate_name: | |
description: 'Name of crate to be published' | |
required: true | |
type: string | |
permissions: | |
contents: read | |
jobs: | |
crate_publish: | |
environment: "publish to crates.io" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
profile: minimal | |
- name: Install build dependencies | |
run: | | |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | |
echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-11 main" | sudo tee -a /etc/apt/sources.list | |
sudo apt-get update | |
sudo apt-get install -y clang-11 cmake | |
if [ -f mbedtls-sys/vendor/scripts/basic.requirements.txt ]; then | |
sudo apt-get install -y python3-pip | |
python3 -m pip install -r mbedtls-sys/vendor/scripts/basic.requirements.txt | |
fi | |
- name: Get name of crate to be published | |
run: | | |
if [[ -z "${{ inputs.crate_name }}" ]]; then | |
# Extract the crate name from the GITHUB_REF environment variable | |
# GITHUB_REF contains the GitHub reference (e.g., refs/tags/mbedtls-sys-auto_v3.5.0) associated with the event | |
export CRATE_NAME=$(python3 -c "print('$GITHUB_REF'.split('/')[2].rsplit('_v', 1)[0])") | |
else | |
export CRATE_NAME="${{ inputs.crate_name }}" | |
fi | |
echo "CRATE_NAME=$CRATE_NAME" >> $GITHUB_ENV | |
- name: Publish crate to crates.io | |
run: | | |
echo "Publishing crate: $CRATE_NAME" | |
cargo publish --locked --token ${CARGO_REGISTRY_TOKEN} --package "$CRATE_NAME" | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
RUSTFLAGS: "-A ambiguous_glob_reexports" | |
RUST_BACKTRACE: "1" | |
PYTHONDONTWRITEBYTECODE: "1" |