Skip to content

Commit

Permalink
Add create Github release for tags.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mdwn committed Apr 2, 2024
1 parent 6412e00 commit 85ddf9e
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 4 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/mtrack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
18 changes: 17 additions & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
17 changes: 14 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 85ddf9e

Please sign in to comment.