Skip to content

Commit

Permalink
add changelog for version source of truth
Browse files Browse the repository at this point in the history
  • Loading branch information
hall committed Jan 9, 2023
1 parent b4638e5 commit 87f06e3
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 5 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
pull_request:
push:
jobs:
build:
main:
runs-on: ubuntu-latest
steps:
- name: checkout
Expand All @@ -18,9 +18,21 @@ jobs:
run: nix flake check
- name: build
run: nix build
- name: bump
id: bump
if: github.ref == 'refs/heads/main'
run: |
latest=$(git tag | sort -n | tail -1)
version=$(cat CHANGELOG.md | grep '^## \[[0-9]' | head -1 | cut -d "[" -f2 | cut -d "]" -f1)
if [[ "$version" != "$latest" ]]; then
git tag $version
git push --tags -o ci.skip
echo version=$version >> $GITHUB_OUTPUT
fi
- name: release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main'
if: steps.bump.outputs.version
with:
prerelease: true # TODO: version things
prerelease: true # TODO: make conditional
files: result/little-buddy*.bin
tag_name: ${{ steps.bump.outputs.version }}
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# 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.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.0.0] - 2023-01-09

### Added

- init from upstream SDK release on Pine64's wiki
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ flashrom -p pony_spi:dev=/dev/ttyACM0 -w out/open_source/open_source.bin
minicom -D /dev/ttyACM0
```

## release

Create a new release by moving the "Unreleased" section in [`CHANGELOG.md`](./CHANGELOG.md) to a new version.
Once pushed the [`main.yml`](./.github/workflows/main.yml) workflow will create a new release.

## notes

> **NOTE**: upstream wrote this; leaving until I better understand
Expand Down
5 changes: 3 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
{
packages.default = pkgs.stdenv.mkDerivation rec {
name = "little-buddy";
version = "0.0.0"; # TODO: get version from tags?
src = ./.;
makeFlags = [
# "-j"
Expand All @@ -32,8 +31,10 @@
minicom
];
installPhase = ''
version=$(cat CHANGELOG.md | grep '^## \[[0-9]' | head -1 | cut -d "[" -f2 | cut -d "]" -f1)
mkdir -p $out
mv ./out/open_source/open_source.bin $out/${name}-${version}.bin
mv ./out/open_source/open_source.bin $out/${name}-$version.bin
'';
};
});
Expand Down

0 comments on commit 87f06e3

Please sign in to comment.