Skip to content

release

release #34

Workflow file for this run

# The `release` operation is never automatic; you must manually invoke the workflow explicitly
name: release
"on":
workflow_dispatch:
inputs:
bumpLevel:
description: 'Which version number to bump (either patch, minor, or major)'
required: true
env:
# Just a reassurance to mitigate sudden network connection problems
CARGO_NET_RETRY: 50
RUSTUP_MAX_RETRIES: 50
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
CARGO_REGISTRIES_ELASTIO_PRIVATE_TOKEN: ${{ secrets.CLOUDSMITH_API_TOKEN }}
# We don't need any debug symbols on ci, this also speeds up builds a bunch
RUSTFLAGS: --deny warnings -Cdebuginfo=0
RUSTDOCFLAGS: --deny warnings
jobs:
# This is just a sanity check to make sure the code is minimally correct.
# It's assumed that this is being performed on a repo with a green `master` that has passed all checks
rust-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions-rs/toolchain@v1
with:
profile: minimal
components: rustfmt, clippy
- run: git config --global credential.helper store && echo https://token:${{ secrets.PRIVATE_REGISTRY_TOKEN }}@dl.cloudsmith.io > $HOME/.git-credentials
- run: sudo apt-get install -y linux-headers-$(uname -r)
- run: cargo fmt --all -- --check
- run: cargo doc --workspace --no-deps
- run: cargo clippy --workspace --all-targets --all-features
publish-crates:
# Publishing happens only on pushes to master. Other branches and PRs don't count
if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
# This job must execute only if all checks pass!
needs:
- rust-lint
env:
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_TOKEN }}
steps:
# NASTY: This token must be the PAT of a user who has admin access to the repo
# in order to bypass branch protections and commit directly to master.
- uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.TSAR_FERRIS_GITHUB_TOKEN }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
# Install cloudsmith CLI via pip
- uses: actions/setup-python@v4
- run: pip install cloudsmith-cli
# A committer identity is required in order to commit things
- run: |
git config user.name "Tsar Ferris"
git config user.email [email protected]
- run: git config --global credential.helper store && echo https://token:${{ secrets.PRIVATE_REGISTRY_TOKEN }}@dl.cloudsmith.io > $HOME/.git-credentials
- name: Install xelastio
uses: elastio/actions/install@v1
with:
tool: xelastio
# Perform the actual release operations
- run: cargo xelastio publish release ${{ github.event.inputs.bumpLevel }}