Merge pull request #39 from ral-facilities/35_test_improvements #29
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 Build | |
on: | |
push: | |
branches: master | |
tags: '*' | |
jobs: | |
build: | |
name: Release Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v2 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Cache maven dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-m2- | |
- name: Move over setting.xml to .m2 directory | |
run: mv provision/settings.xml ~/.m2 | |
- name: Determine version | |
run: | | |
echo VERSION=`mvn help:evaluate -Dexpression=project.version -q -DforceStdout` >> $GITHUB_ENV | |
- name: Build | |
run: | | |
mvn clean install -DskipTests | |
cp target/datagateway-download-api-$VERSION-distro.zip . | |
- name: Determine tag name | |
run: | | |
if [ "${{ github.ref }}" = "refs/heads/master" ] | |
then | |
echo TAG_NAME=$VERSION >> $GITHUB_ENV | |
else | |
echo TAG_NAME=`basename ${{ github.ref }}` >> $GITHUB_ENV | |
fi | |
- name: Check that version ends with -SNAPSHOT (if on master) | |
uses: nick-invision/assert-action@v1 | |
with: | |
expected: '-SNAPSHOT' | |
actual: ${{ env.TAG_NAME }} | |
comparison: endsWith | |
if: ${{ github.ref == 'refs/heads/master' }} | |
- name: Update SNAPSHOT tag | |
uses: richardsimko/update-tag@v1 | |
with: | |
tag_name: ${{ env.TAG_NAME }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
if: ${{ github.ref == 'refs/heads/master' }} | |
- name: Create/update release | |
uses: johnwbyrd/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: ./datagateway-download-api-${{ env.VERSION }}-distro.zip | |
release: Release ${{ env.TAG_NAME }} | |
tag: ${{ env.TAG_NAME }} | |
prerelease: ${{ github.ref == 'refs/heads/master' }} | |
draft: false |