Merge pull request #280 from LedgerHQ/y333/fix_nbgl_streaming_review #165
This file contains hidden or 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 to Crates.io | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: # Allow manual workflow dispatch | |
jobs: | |
dry-run-publish: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'workflow_dispatch' # Only run this job for manual triggers | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Set Up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
- name: Test Dry-Run Publish for Each Package | |
run: | | |
# Iterate through package names retrieved | |
PACKAGE_NAMES="testmacro include_gif ledger_secure_sdk_sys ledger_device_sdk" | |
for PACKAGE_NAME in $PACKAGE_NAMES; do | |
# Test a dry-run publish for each package within the workspace if required | |
last_published_version=$(cargo search -q --limit 1 $PACKAGE_NAME | grep -oP '\d+\.\d+\.\d+') | |
echo "Published version of $PACKAGE_NAME is $version_published" | |
manifest_version=$(cargo metadata --format-version=1 --no-deps | jq -r --arg PACKAGE_NAME "$PACKAGE_NAME" '.packages[] | select(.name == $PACKAGE_NAME) | .version') | |
echo "Current version in manifest for $PACKAGE_NAME is $manifest_version" | |
if [ "$last_published_version" == "$manifest_version" ]; then | |
echo "Package $PACKAGE_NAME is already published with version $manifest_version." | |
else | |
echo "Package $PACKAGE_NAME is not published with version $manifest_version." | |
echo "Dry-run publishing $PACKAGE_NAME..." | |
cargo publish --dry-run --no-verify --token ${{ secrets.CARGO_REGISTRY_TOKEN }} --package "$PACKAGE_NAME" | |
fi | |
done | |
env: | |
CARGO_TERM_COLOR: always | |
working-directory: ${{ github.workspace }} | |
crates-io-publish: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' # Only run this job for pushes | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Set Up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
- name: Publish Package on crates.io if required | |
run: | | |
# Iterate through package names retrieved | |
PACKAGE_NAMES="testmacro include_gif ledger_secure_sdk_sys ledger_device_sdk" | |
for PACKAGE_NAME in $PACKAGE_NAMES; do | |
# Publish each package within the workspace if required | |
last_published_version=$(cargo search -q --limit 1 $PACKAGE_NAME | grep -oP '\d+\.\d+\.\d+') | |
echo "Published version of $PACKAGE_NAME is $last_published_version" | |
manifest_version=$(cargo metadata --format-version=1 --no-deps | jq -r --arg PACKAGE_NAME "$PACKAGE_NAME" '.packages[] | select(.name == $PACKAGE_NAME) | .version') | |
echo "Current version in manifest for $PACKAGE_NAME is $manifest_version" | |
if [ "$last_published_version" == "$manifest_version" ]; then | |
echo "Package $PACKAGE_NAME is already published with version $manifest_version." | |
else | |
echo "Package $PACKAGE_NAME with version $manifest_version is not published." | |
echo "Publishing $PACKAGE_NAME..." | |
cargo publish --no-verify --token ${{ secrets.CARGO_REGISTRY_TOKEN }} --package "$PACKAGE_NAME" | |
fi | |
done | |
env: | |
CARGO_TERM_COLOR: always | |
working-directory: ${{ github.workspace }} |