From f376f06120ca2409be4d69e34da0e53a7a45a64e Mon Sep 17 00:00:00 2001 From: Stephen L Arnold Date: Mon, 1 Mar 2021 18:23:43 -0800 Subject: [PATCH 1/3] chg: doc: add dogfood example repo, update usage a bit Signed-off-by: Stephen L Arnold --- README.rst | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index bc76191..05644f5 100644 --- a/README.rst +++ b/README.rst @@ -41,11 +41,23 @@ is shown below. .. _MarkDown: https://www.markdownguide.org/ .. _softprops/action-gh-release: https://github.com/softprops/action-gh-release +Examples +======== + +The canonical dogfood_ example is the `release.yml`_ and corresponding +`github release page`_ in the gitchangelog repo (for a non-platform wheel). + + +.. _dogfood: http://catb.org/jargon/html/D/dogfood.html +.. _release.yml: https://github.com/sarnold/gitchangelog/blob/master/.github/workflows/release.yml#L58 +.. _github release page: https://github.com/sarnold/gitchangelog/releases/tag/3.0.7 + Usage ===== -Create a .yml file under .github/workflows with the following contents. +To enable the default release page changes file, create a .yml file under +.github/workflows with the following contents. Default configuration --------------------- @@ -70,6 +82,12 @@ Default configuration github_token: ${{ secrets.GITHUB_TOKEN}} +The above is enough to generate the default release output, but should +be paired with a release action to populate the github release page (as +shown below). The action will try its best to figure out the current +and previous tags, however, if you set the VERSION variable it will be +used for the current tag in the change diff. + Full configuration ------------------ From b582dd76fb9ec173adef580705c977487c29a599 Mon Sep 17 00:00:00 2001 From: Stephen L Arnold Date: Mon, 1 Mar 2021 19:36:16 -0800 Subject: [PATCH 2/3] chg: test: set override version for latest tag Signed-off-by: Stephen L Arnold --- .github/workflows/main.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 93694a6..c7a985d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,7 +9,14 @@ on: jobs: gitchangelog_test: - runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + os: [ubuntu-18.04, ubuntu-20.04] + + runs-on: ${{ matrix.os }} + name: Test changelog steps: # To use this repository's private action, @@ -19,6 +26,13 @@ jobs: with: fetch-depth: 0 + - name: Get version + if: matrix.os == 'ubuntu-20.04' + id: get_version + run: | + echo "VERSION=$(git describe --abbrev=0 --tags)" >> $GITHUB_ENV + echo ${{ env.VERSION }} + - name: gitchangelog action step (debug) uses: ./ # Uses an action in the root directory with: From e54d2c996fea3147241891643cbf520d44244ef5 Mon Sep 17 00:00:00 2001 From: Stephen L Arnold Date: Mon, 1 Mar 2021 20:39:01 -0800 Subject: [PATCH 3/3] chg: test: check changelog output with/without version in env Signed-off-by: Stephen L Arnold --- .github/workflows/main.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c7a985d..33d69e1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,6 +16,9 @@ jobs: os: [ubuntu-18.04, ubuntu-20.04] runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash name: Test changelog steps: @@ -41,6 +44,16 @@ jobs: - name: Display changes file run: cat CHANGES.md + - name: Test changes file + run: | + export VERSION=${{ env.VERSION }} + export TITLE_VERSION=$(cat CHANGES.md | head -n1 | cut -f2 -d" ") + if [[ -n $VERSION ]]; then + [[ "${TITLE_VERSION}" == "${VERSION}" ]] || exit 1 + else + [[ "${TITLE_VERSION}" == "(unreleased)" ]] || exit 1 + fi + - name: Checkout test repo uses: actions/checkout@v2 with: