Skip to content

wdlTools Release

wdlTools Release #48

Workflow file for this run

# TODO: update conda-forge recipe
name: wdlTools Release
on:
workflow_dispatch:
inputs:
release-version:
description: 'Release version'
required: false
permissions:
contents: write
packages: write
jobs:
run-release:
name: wdlTools Release
runs-on: ubuntu-20.04
steps:
- name: Git checkout
uses: actions/checkout@v2
- name: Install java
uses: actions/setup-java@v1
with:
java-version: 11
- name: Install & build
run: |
# compile antlr4 sources
cd ${GITHUB_WORKSPACE}
make
- name: Unit Tests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SBT_OPTS: "-XX:+CMSClassUnloadingEnabled -Xmx4G -Xms1G"
run: |
sbt scalafmtCheckAll
sbt test
- name: Get version
id: version
run: |
# Default to the version in the branch name
if [[ -z "${{ github.event.inputs.release-version }}" ]]; then
version=`echo '${{ github.ref }}' | sed -E 's/refs\/heads\/release-([\d.]*)/\1/g'`
else
version="${{ github.event.inputs.release-version }}"
fi
version_check=`echo ${version} | grep -o -P "^\d+\.\d+\.\d+$"`
if [ -z "$version_check" ]; then
echo "wdlTools version '${version}' is not a valid release version"
exit 1
fi
echo ::set-output name=version::"${version}"
- name: Assembly
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
sbt assembly
mv ./target/wdlTools.jar ./wdlTools-${{ steps.version.outputs.version }}.jar
- name: Extract release notes and set version in application.conf files
id: update-release
run: |
# Update the config file with the newest version
sed -i 's/version.*$/version = "${{ steps.version.outputs.version }}"/' ./src/main/resources/application.conf
# Extract release notes for the release into a temporary (unpushed) file
# It is expected the RELEASE_NOTES.md has already an entry for the version being
# released. The section should start with '## <version>', e.g. ## 1.0.0 2021-01-01
# The file will be read by the create-release step
RELEASE_NOTES_PATH="./release_notes_${{ steps.version.outputs.version }}.md"
sed -n '/## ${{ steps.version.outputs.version }}/,/##/p' RELEASE_NOTES.md | sed '1d; $d' > $RELEASE_NOTES_PATH
echo ::set-output name=release-notes-path::$(echo "${RELEASE_NOTES_PATH}")
- name: Commit changes to application.conf files
uses: EndBug/add-and-commit@v7
with:
message: 'Release ${{ steps.version.outputs.version }}'
add: '[
"./src/main/resources/application.conf"
]'
push: false
tag: ${{ steps.version.outputs.version }}
- name: Create release entry
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.version }}
release_name: wdlTools ${{ steps.version.outputs.version }}
body_path: ${{ steps.update-release.outputs.release-notes-path }}
draft: true
prerelease: false
- name: Upload assembly JAR
id: upload-release-assembly
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# This pulls from the "Create release entry" step above, referencing it's ID to get its outputs object,
# which include a `upload_url`. See this blog post for more info:
# https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ./wdlTools-${{ steps.version.outputs.version }}.jar
asset_name: wdlTools-${{ steps.version.outputs.version }}.jar
asset_content_type: application/jar
- name: Push local release branch and tag to origin
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git push origin HEAD:${{ github.ref }}
git push origin HEAD:${{ steps.version.outputs.version }}
- name: Publish package
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
sbt publish
- name: Rollback release if unsuccessfull
if: ${{ cancelled() || failure() }}
uses: author/action-rollback@stable
with:
release_id: ${{ steps.create-release.outputs.id }}
tag: ${{ steps.version.outputs.version }}
delete_orphan_tag: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}