From 85ddf9e04b1e937d88c5b54b0ad6c227b45d5660 Mon Sep 17 00:00:00 2001 From: Michael Wilson Date: Tue, 2 Apr 2024 13:16:30 -0400 Subject: [PATCH] Add create Github release for tags. A Github release will be created for tags now. Additionally, a check has been added that will ensure that Cargo.lock is up to date. The CHANGELOG has been adjusted into keepachangelog format to aide in automatically publishing release notes. --- .github/workflows/mtrack.yaml | 35 ++++++++++++++++++++++++++++++++++ .github/workflows/publish.yaml | 18 ++++++++++++++++- CHANGELOG.md | 17 ++++++++++++++--- 3 files changed, 66 insertions(+), 4 deletions(-) diff --git a/.github/workflows/mtrack.yaml b/.github/workflows/mtrack.yaml index 91b375a..95c17ea 100644 --- a/.github/workflows/mtrack.yaml +++ b/.github/workflows/mtrack.yaml @@ -8,6 +8,28 @@ on: - main jobs: + # Build the code and verify that Cargo.lock is up to date. + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Update apt + run: sudo apt update + - name: Install alsa + run: sudo apt-get install -y libasound2-dev + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + - name: Build mtrack + run: cargo build + - name: Check of Cargo.lock is up to date + run: | + if git diff --exit-code Cargo.lock; then + echo "Cargo.lock is up to date." + else + echo "Cargo.lock needs to be updated." + exit 1 + fi + # Clippy effectively lints the code. clippy: runs-on: ubuntu-latest @@ -71,3 +93,16 @@ jobs: run: cargo install licensure - name: Check for licenses run: licensure --check -p + + # Verify changelog is in keep-a-changelog format. + verify-changelog: + name: Create a GitHub release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + # We'll run the extract release notes action and drop the results on the floor. + # This should hopefully validate the changelog format. + - name: Extract release notes + id: extract-release-notes + uses: ffurrer2/extract-release-notes@v2 \ No newline at end of file diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 59f5dd3..7ce93f4 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -2,11 +2,12 @@ name: publish on: push: tags: - - 'v*' + - 'v*.*.*' jobs: # Publishes mtrack to crates.io. publish: + name: Publish to crates.io runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -20,3 +21,18 @@ jobs: env: CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} run: cargo publish + + # Creates a release on Github. + release: + name: Create a GitHub release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Extract release notes + id: extract-release-notes + uses: ffurrer2/extract-release-notes@v2 + - name: Create release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: gh release create --notes '${{ steps.extract-release-notes.outputs.release_notes }}' --title ${{ github.ref_name }} ${{ github.ref_name }} diff --git a/CHANGELOG.md b/CHANGELOG.md index f5423be..9d18c10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,18 @@ -# 0.1.1 +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [0.1.1] - Minor dependency update. Removal of unneeded ringbuffer dependency. -# 0.1.0 +## [0.1.0] - Initial release. + +### Added -Initial release. +- Initial release.