Publish #61
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 | |
on: | |
workflow_dispatch | |
env: | |
rust_toolchain: nightly | |
crate_name: esp-idf-sys | |
jobs: | |
publish: | |
name: Publish | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup | Checkout | |
uses: actions/checkout@v3 | |
- name: Setup | Rust | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: ${{ env.rust_toolchain }} | |
components: rust-src | |
- name: Login | |
run: cargo login ${{ secrets.crates_io_token }} | |
- name: Build | Publish | |
run: export ESP_IDF_TOOLS_INSTALL_DIR=out; export ESP_IDF_SDKCONFIG_DEFAULTS=$(pwd)/.github/configs/sdkconfig.defaults; cargo publish --target riscv32imc-esp-espidf -Zbuild-std=std,panic_abort -Zbuild-std-features=panic_immediate_abort | |
- name: Build Documentation | |
run: cargo doc --features native --target riscv32imc-esp-espidf -Zbuild-std=std,panic_abort -Zbuild-std-features=panic_immediate_abort; echo "<meta http-equiv=\"refresh\" content=\"0; url=esp_idf_sys\">" > target/riscv32imc-esp-espidf/doc/index.html; mv target/riscv32imc-esp-espidf/doc ./docs | |
- name: Deploy Documentation | |
if: ${{ github.ref == 'refs/heads/master' }} | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
force_orphan: true | |
publish_dir: ./docs | |
- name: Get the crate version from cargo | |
run: | | |
version=$(cargo metadata --format-version=1 --no-deps | jq -r ".packages[] | select(.name == \"${{env.crate_name}}\") | .version") | |
echo "crate_version=$version" >> $GITHUB_ENV | |
echo "${{env.crate_name}} version: $version" | |
- name: Tag the new release | |
uses: rickstaa/action-create-tag@v1 | |
with: | |
tag: v${{env.crate_version}} | |
message: "Release v${{env.crate_version}}" |