forked from icatproject/topcat
-
Notifications
You must be signed in to change notification settings - Fork 2
75 lines (64 loc) · 2.12 KB
/
release-build.yml
File metadata and controls
75 lines (64 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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@v5
with:
distribution: 'temurin'
java-version: 11
- name: Cache maven dependencies
uses: actions/cache@v5
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@v2
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: IsaacShelton/update-existing-release@v1.3.5
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