File tree Expand file tree Collapse file tree 4 files changed +99
-0
lines changed
Expand file tree Collapse file tree 4 files changed +99
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ file=" ./CHANGELOG.md"
4+ regex=' ^## \[([0-9]+)\.([0-9]+)\.([0-9]+)\] - ([0-9]{4}-[0-9]{2}-[0-9]{2})$'
5+
6+ version=' '
7+ log=()
8+
9+ while read line; do
10+ if [[ $line =~ $regex ]]; then
11+ if [[ -z " $version " ]]; then
12+ major=" ${BASH_REMATCH[1]} "
13+ minor=" ${BASH_REMATCH[2]} "
14+ patch=" ${BASH_REMATCH[3]} "
15+ version=" $major .$minor .$patch "
16+ date=" ${BASH_REMATCH[4]} "
17+ else
18+ break
19+ fi
20+ elif [[ ! -z " $version " ]]; then
21+ log+=(" $line " )
22+ fi
23+ done <<< " $(cat " $file " )"
Original file line number Diff line number Diff line change 1+ name : Pre Release
2+ on :
3+ pull_request :
4+ paths : [CHANGELOG.md]
5+ branches : [master]
6+ jobs :
7+ Post-Comment :
8+ name : Post Comment
9+ runs-on : ubuntu-latest
10+ steps :
11+ - uses : actions/checkout@v2
12+ - run : |
13+ source .github/scripts/changelog.sh
14+ git fetch origin --tags
15+ if [[ -z "$(git tag -l "v$version")" ]]; then
16+ echo "BODY<<EOF" >> $GITHUB_ENV
17+ echo "$(IFS=$'\n'; echo "${log[*]}")" >> $GITHUB_ENV
18+ echo "EOF" >> $GITHUB_ENV
19+ echo "TAG=v$version" >> $GITHUB_ENV
20+ fi
21+ shell: bash
22+ - if : ${{ env.TAG != '' }}
23+ uses : marocchino/sticky-pull-request-comment@82e7a0d3c51217201b3fedc4ddde6632e969a477 # v2.1.1
24+ with :
25+ header : pre-release
26+ recreate : true
27+ message : |
28+ ## ${{ env.TAG }}
29+
30+ ${{ env.BODY }}
Original file line number Diff line number Diff line change 1+ name : Release
2+ on :
3+ workflow_dispatch :
4+ push :
5+ paths : [CHANGELOG.md]
6+ branches : [master]
7+ jobs :
8+ Publish :
9+ name : Publish
10+ runs-on : ubuntu-latest
11+ steps :
12+ - uses : actions/checkout@v2
13+ - run : |
14+ source .github/scripts/changelog.sh
15+ git fetch origin --tags
16+ if [[ -z "$(git tag -l "v$version")" ]]; then
17+ git tag "v$major.$minor.$patch"
18+ git tag "v$major.$minor" --force
19+ git tag "v$major" --force
20+ git push --tags --force
21+ echo "BODY<<EOF" >> $GITHUB_ENV
22+ echo "$(IFS=$'\n'; echo "${log[*]}")" >> $GITHUB_ENV
23+ echo "EOF" >> $GITHUB_ENV
24+ echo "TAG=v$version" >> $GITHUB_ENV
25+ fi
26+ shell: bash
27+ - if : ${{ env.TAG != '' }}
28+ uses : ncipollo/release-action@40bb172bd05f266cf9ba4ff965cb61e9ee5f6d01 # v1.9.0
29+ with :
30+ body : |
31+ ${{ env.BODY }}
32+ tag : ${{ env.TAG }}
33+ token : ${{ secrets.GITHUB_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+ ## [ Unreleased]
8+ ### Added
9+ - release workflows
10+ - changelog
11+
12+ ### Changed
13+ - the repository from https://github.com/coryschwartz/testground-github-action to https://github.com/testground/testground-github-action
You can’t perform that action at this time.
0 commit comments