Skip to content

Commit

Permalink
fix: update shell env and rename default cfg, update workflow/readme
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen L Arnold <[email protected]>
  • Loading branch information
sarnold committed Feb 27, 2021
1 parent 2ea09c7 commit 9ebe8e0
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 10 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ jobs:

- name: Display changes file
run: cat CHANGES.md

- name: Checkout test repo
uses: actions/checkout@v2
with:
repository: sarnold/gitchangelog
path: gcl-test
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RUN apk --no-cache add \

RUN pip3 install https://github.com/sarnold/gitchangelog/archive/3.0.5.tar.gz

ADD ./.gitchangelog-release.rc /.gitchangelog-release.rc
ADD ./gitchangelog-release.rc /gitchangelog-release.rc

ADD ./genchangelog.sh /genchangelog.sh

Expand Down
39 changes: 32 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ By default this action will ues the ``gitchangelog.rc.github.release``
config file installed by the gitchangelog package.


.. _reStructuredText: https://docutils.sourceforge.io/rst.html
.. _MarkDown: https://www.markdownguide.org/


Usage
=====
Expand Down Expand Up @@ -58,29 +61,51 @@ Default configuration
github_token: ${{ secrets.GITHUB_TOKEN}}


Advanced configuration
----------------------
Full configuration
------------------

::

name: gitchangelog
on: [push]
on:
push:
# trigger a release on any tag push
tags:
- '*'

jobs:
build:
# build stuff here to create release artifacts if needed

release:
name: gitchangelog-action
name: gitchangelog with gh-release action
runs-on: ubuntu-latest
steps:
- name: Get version
id: get_version
run: |
echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
echo ${{ VERSION }}

- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: gitchangelog action step
- name: Generate changes file
uses: sarnold/gitchangelog-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN}}
output_file: CHANGELOG.rst
config_file: .gitchangelog-custom.rc

- name: Create release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
name: Release ${{ env.VERSION }}
body_path: CHANGES.md
draft: true
prerelease: false


Input Options
Expand Down
6 changes: 4 additions & 2 deletions genchangelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ echo "Found: ${GIT_VERSION}"
NUM_TAGS=$(git tag -l | wc -l)
echo "Number of tags found: ${NUM_TAGS}"

CONFIG_FILE="gitchangelog-release.rc"
if [[ -n "$INPUT_CONFIG_FILE" ]]; then
GITCHANGELOG_CONFIG_FILENAME="${INPUT_CONFIG_FILE}"
else
GITCHANGELOG_CONFIG_FILENAME="./.gitchangelog-release.rc"
GITCHANGELOG_CONFIG_FILENAME="${CONFIG_FILE}"
fi
export GITCHANGELOG_CONFIG_FILENAME${GITCHANGELOG_CONFIG_FILENAME}
echo "Config file: ${GITCHANGELOG_CONFIG_FILENAME}"

if [[ -n "$INPUT_OUTPUT_FILE" ]]; then
Expand All @@ -24,7 +26,7 @@ if [[ "${NUM_TAGS}" = "0" || "${NUM_TAGS}" = "1" ]]; then
echo "No previous tag found, generating full changelog ..."
CMD="gitchangelog --debug"
else
VERSION=${GITHUB_REF/refs\/tags\//}
[[ -n $VERSION ]] || VERSION=${GITHUB_REF/refs\/tags\//}
echo "Current version ref: ${VERSION}"
CURRENT_TAG="${VERSION}"
echo "If this is a tag, we use it: ${CURRENT_TAG}"
Expand Down
File renamed without changes.

0 comments on commit 9ebe8e0

Please sign in to comment.