Create Release #5
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: Create Release | |
on: | |
#schedule: | |
#- cron: '0 0 1 * *' | |
workflow_dispatch: | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup BATS | |
uses: mig4/setup-bats@v1 | |
with: | |
bats-version: 1.2.1 | |
- name: Compile | |
run: | | |
make test | |
make docs | |
- name: Get version | |
id: version | |
run: | | |
# Get current version number | |
rm -f gxadmin | |
make gxadmin | |
CURRENT_VERSION=$(./gxadmin --version) | |
NEW_VERSION=$(( CURRENT_VERSION + 1 )) | |
NEXT_VERSION=$(( CURRENT_VERSION + 2 )) | |
echo $CURRENT_VERSION $NEW_VERSION | |
#echo "::set-output name=timestamp::${TS}" | |
#echo "::set-output name=tag::v${VERSION}-preview-${TS}" | |
echo "tag=v${NEW_VERSION}" >> $GITHUB_ENV | |
# Update version number in changelog | |
sed -i "s/# ${NEW_VERSION}-pre/# ${NEXT_VERSION}-pre\n\n# ${NEW_VERSION}/g" CHANGELOG.md | |
# Update version number in gxadmin | |
sed -i "s/echo ${CURRENT_VERSION}/echo ${NEW_VERSION}/" parts/00-header.sh | |
# Fetch changelog | |
sed -n "/# ${NEW_VERSION}/,/# ${CURRENT_VERSION}/{/# ${CURRENT_VERSION}/b;p}" CHANGELOG.md > body.md | |
TODAY=$(date -I) | |
sed -i "s/version: v.*/version: v${NEW_VERSION}/" CITATION.cff | |
sed -i "s/date-released: .*/date-released: ${TODAY}/" CITATION.cff | |
# Check AGAIN | |
make test | |
make docs | |
make gxadmin | |
git config user.email "[email protected]" | |
git config user.name "Helena (Bot)" | |
# Update release | |
git add parts/00-header.sh CHANGELOG.md CITATION.cff | |
git commit -a -m "Release v${NEW_VERSION}" | |
git push | |
#git tag v${NEW_VERSION} | |
#git push --follow-tags | |
#- name: Extract changelog | |
#run: | | |
#bash gxadmin meta whatsnew >> body.md | |
- uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "gxadmin" | |
artifactContentType: text/x-shellscript | |
bodyFile: body.md | |
commit: main | |
draft: false | |
tag: ${{ env.tag }} |