File tree Expand file tree Collapse file tree 3 files changed +50
-1
lines changed Expand file tree Collapse file tree 3 files changed +50
-1
lines changed Original file line number Diff line number Diff line change @@ -220,3 +220,33 @@ jobs:
220220 with :
221221 push : ${{ github.event_name != 'pull_request' }}
222222 targets : ${{ steps.target.outputs.TARGET }}
223+
224+ create_release :
225+ if : ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
226+ runs-on : ubuntu-22.04
227+ steps :
228+ - name : Checkout the code
229+ uses : actions/checkout@v3
230+ with :
231+ # We need to pull tags as well, so that we can
232+ # grab the latest releases for changelog actions
233+ fetch-depth : 0
234+
235+ # Get information from the CHANGELOG. By default,
236+ # this action grabs the latest version
237+ - name : Get latest CHANGELOG version
238+ id : changelog_reader
239+ uses : mindsers/changelog-reader-action@b97ce03a10d9bdbb07beb491c76a5a01d78cd3ef
240+ with :
241+ path : ./CHANGELOG.md
242+
243+ - name : Create/update release
244+ uses : ncipollo/release-action@6c75be85e571768fa31b40abf38de58ba0397db5
245+ with :
246+ # This pulls from the "Get Changelog Entry" step above, referencing it's ID to get its outputs object.
247+ # See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
248+ tag : ${{ steps.changelog_reader.outputs.version }}
249+ name : Release ${{ steps.changelog_reader.outputs.version }}
250+ body : ${{ steps.changelog_reader.outputs.changes }}
251+ allowUpdates : false
252+ token : ${{ secrets.NBL_GITHUB_PACKAGES_TOKEN }}
Original file line number Diff line number Diff line change 1+ # Changelog
2+ All notable changes to this project will be documented in this file.
3+
4+ The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
5+ and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
6+
7+ ## [ 0.0.1] - 2023-09-20
8+ ### Added
9+ - Added automatic release creation via CHANGELOG
Original file line number Diff line number Diff line change @@ -14,10 +14,20 @@ PR_NUMBER=${3:-0}
1414
1515TIMESTAMP=$( date)
1616
17+ # If 'main' or 'PR', we add a handle ('latest', 'pr-XXX') to the image
18+ # We don't provide a handle for releases
1719if [[ " ${REF} " == " main" ]]; then
1820 echo " HANDLE=latest" >> " ${GITHUB_ENV} "
1921elif [[ " ${EVENT} " == " pull_request" ]]; then
2022 echo " HANDLE=pr-${PR_NUMBER} " >> " ${GITHUB_ENV} "
2123fi
22- echo " TAG=${GITHUB_SHA} " >> " ${GITHUB_ENV} "
24+
25+ # If a release, we use the tag, otherwise we use the commit SHA
26+ if [[ " ${EVENT} " == " release" ]]; then
27+ echo " TAG=${GITHUB_REF} " >> " ${GITHUB_ENV} "
28+ else
29+ echo " TAG=${GITHUB_SHA} " >> " ${GITHUB_ENV} "
30+ fi
31+
32+ # Always output the timestamp for builds
2333echo " TIMESTAMP=${TIMESTAMP} " >> " ${GITHUB_ENV} "
You can’t perform that action at this time.
0 commit comments