Skip to content

Merge pull request #31 from ral-facilities/dependabot/maven/ch.qos.lo… #30

Merge pull request #31 from ral-facilities/dependabot/maven/ch.qos.lo…

Merge pull request #31 from ral-facilities/dependabot/maven/ch.qos.lo… #30

Workflow file for this run

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