From 278c09c6eb23b8216535357599eb647c5b323ebe Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Mon, 22 Apr 2024 13:48:35 +0200 Subject: [PATCH] ci: add changelog check (#123) --- .github/workflows/changelog.yml | 39 +++++++++++++++++++++++++++++++++ CHANGELOG.md | 30 +++++++++++++++++++++++++ README.md | 6 ++++- docs/environment-variables.md | 2 +- 4 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/changelog.yml create mode 100644 CHANGELOG.md diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml new file mode 100644 index 0000000..59b04c1 --- /dev/null +++ b/.github/workflows/changelog.yml @@ -0,0 +1,39 @@ +name: Changelog + +on: + pull_request: + types: + - opened + - edited + - synchronize + - reopened + - labeled + - unlabeled + paths: + - '**.go' + - '**/go.mod' + - '**/go.sum' + +jobs: + changelog: + if: contains(github.event.pull_request.title, '[skip changelog]') == false && + contains(github.event.pull_request.labels.*.name, 'skip/changelog') == false + runs-on: ubuntu-latest + name: Changelog + steps: + - id: changelog + env: + GITHUB_TOKEN: ${{ github.token }} + ENDPOINT: repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files + SELECTOR: 'map(select(.filename == "CHANGELOG.md")) | length' + run: gh api "$ENDPOINT" --jq "$SELECTOR" | xargs -I{} echo "modified={}" | tee -a $GITHUB_OUTPUT + - if: steps.changelog.outputs.modified == '0' + env: + MESSAGE: | + CHANGELOG.md was not modified in this PR. Please do one of the following: + - add a changelog entry + - add `[skip changelog]` to the PR title + - label the PR with `skip/changelog` + run: | + echo "::error::${MESSAGE//$'\n'/%0A}" + exit 1 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..c7cb9a9 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,30 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +Note: +* The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). +* This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## Legend +The following emojis are used to highlight certain changes: +* 🛠 - BREAKING CHANGE. Action is required if you use this functionality. +* ✨ - Noteworthy change to be aware of. + +## [Unreleased] + +### Added + +- ✨ Now supports local cache sharing with peers provided via `--peering` (`RAINBOW_PEERING`). You can further read how this works in [`docs/environment-variables.md`](docs/environment-variables.md). + +### Changed + +### Removed + +### Fixed + +### Security + +## [v1.0.0] + +Our first version. Check the [README](README.md) for all the information regarding 🌈 Rainbow. diff --git a/README.md b/README.md index b369d90..7435a6c 100644 --- a/README.md +++ b/README.md @@ -142,7 +142,11 @@ An ansible role to deploy Rainbow is available within the ipfs.ipfs collection i ## Release -To make a release, create a new PR that updates the [`version.json`](./version.json) file. This PR should not include any other changes besides the version bump. A new release will be automatically made once the PR is merged +1. Create a PR from branch `release-vX.Y.Z` against `main` that: + 1. Tidies the [`CHANGELOG.md`](CHANGELOG.md) with the changes for the current release + 2. Updates the [`version.json`](./version.json) file +2. Once the release checker creates a draft release, copy-paste the changelog into the draft +3. Merge the PR, the release will be automatically created once the PR is merged ## License diff --git a/docs/environment-variables.md b/docs/environment-variables.md index 7fcc007..3b88421 100644 --- a/docs/environment-variables.md +++ b/docs/environment-variables.md @@ -111,7 +111,7 @@ Enable sharing of local cache to peers safe-listed with `RAINBOW_PEERING`. Once enabled, Rainbow will respond to [Bitswap](https://docs.ipfs.tech/concepts/bitswap/) queries from these safelisted peers, serving locally cached blocks if requested. -The main use case for this feature is scaling and load balancing acrosss a +The main use case for this feature is scaling and load balancing across a fleet of rainbow, or other bitswap-capable IPFS services. Cache sharing allows clustered services to check if any of the other instances has a requested CID. This saves resources as data cached on other instance can be fetched internally