Prepare for release 0.1.6 #21
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: Continuous Integration | |
on: | |
push: | |
branches: ["master"] | |
tags: ["v*"] | |
pull_request: | |
branches: ["master"] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Enable caching | |
uses: Swatinem/rust-cache@v2 | |
- name: Run fmt command | |
run: cargo fmt --all -- --check --color always | |
- name: Run clippy command | |
run: cargo clippy --all-targets --all-features --workspace -- -D warnings | |
deploy: | |
if: github.ref_type == 'tag' | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
env: | |
PACKAGE_NAME: ${{github.event.repository.name}}-${{matrix.chip}}-${{github.ref_name}} | |
strategy: | |
matrix: | |
chip: ["nrf52840"] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Validate version | |
run: | | |
export CARGO_VERSION=v$(awk '/^version/ {print $3}' Cargo.toml | head -1 | tr -d '"') | |
export GIT_VERSION=${{github.ref_name}} | |
echo "Cargo version: $CARGO_VERSION" | |
echo "Git version: $GIT_VERSION" | |
if [[ "${CARGO_VERSION}" != "$GIT_VERSION" ]]; then | |
echo "Tag version and Cargo.toml version don't match" 1>&2 | |
exit 1 | |
fi | |
- name: Enable caching | |
uses: Swatinem/rust-cache@v2 | |
- name: Run build command | |
env: | |
DEFMT_LOG: info | |
run: cargo build --release | |
- name: Package | |
run: | | |
mkdir $PACKAGE_NAME | |
cp target/thumbv7em-none-eabihf/release/tempsys-firmware ${PACKAGE_NAME}/ | |
cp -r README.md LICENSE $PACKAGE_NAME/ | |
tar -czvf ${PACKAGE_NAME}.tar.gz $PACKAGE_NAME | |
- name: Publish release | |
uses: ghalactic/github-release-from-tag@v5 | |
with: | |
generateReleaseNotes: "true" | |
assets: | | |
- path: ${{env.PACKAGE_NAME}}.tar.gz |