Upload updated changelog #185
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
branches: [ master,develop ] | |
jobs: | |
release: | |
runs-on: [self-hosted, Linux, X64] | |
steps: | |
- name: Extract branch name | |
shell: bash | |
run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ env.branch }} | |
- name: Get tag version | |
run: | | |
echo "tag_version=`awk '/^## \[[0-9]+/' CHANGELOG.md | awk 'NR==1 && -F"\[\]" {print $2}' 2>/dev/null | tail -c +2 | head -c -2`" >> $GITHUB_ENV | |
- name: Check if tag is for develop and if it already exists | |
run: | | |
git fetch --prune --tags | |
if [ ${{ env.branch }} == 'develop' ]; then | |
for i in {1..100}; do | |
if [ `git tag --list | grep ${{ env.tag_version }}"-alpha.${i}" | wc -l` -eq 0 ]; then | |
tag_version=${{ env.tag_version }}"-alpha.${i}" | |
echo "tag_version=${tag_version}" >> $GITHUB_ENV | |
break; | |
fi | |
done | |
elif [ `git tag --list | grep -q ${{ env.tag_version }}` -ne 0 ]; then exit 1; fi | |
- name: Get changelog body | |
run: | | |
awk '/^## \[[0-9]+/,EOF' CHANGELOG.md | awk '(NR>1)' | awk '1;/^## \[[0-9]+/{exit}' | sed '$d' > release_body.md | |
- name: Set pre-release boolean | |
run: | | |
prerelease=false | |
if [ ${{ env.branch }} == 'develop' ]; then | |
prerelease=true | |
fi | |
echo "prerelease=$prerelease" >> $GITHUB_ENV | |
- name: Create GitHub release | |
uses: ncipollo/release-action@v1 | |
with: | |
prerelease: ${{ env.prerelease }} | |
commit: ${{ env.branch }} | |
tag: ${{ env.tag_version }} | |
name: ${{ env.tag_version }} | |
token: ${{ secrets.GH_PAT }} # can't use GITHUB_TOKEN as it will not trigger additional events | |
artifacts: "install/install_thinger_monitor.sh" | |
bodyFile: "release_body.md" | |