-
Notifications
You must be signed in to change notification settings - Fork 11
53 lines (48 loc) · 1.74 KB
/
build.yml
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
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
# for future use, see https://github.com/MobilityData/gtfs-validator/blob/add65e0a6f857951ff4d3c19fc268d99d7509e45/core/build.gradle#L22
- name: Prepare version name
id: prep
run: |
VERSION_TAG=edge
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION_TAG=${GITHUB_REF#refs/tags/}
elif [[ $GITHUB_REF == refs/heads/* ]]; then
VERSION_TAG=-$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
elif [[ $GITHUB_REF == refs/pull/* ]]; then
VERSION_TAG=-pr-${{ github.event.number }}
fi
if [ ${VERSION_TAG} != ${GITHUB_REF#refs/tags/} ]; then
VERSION_TAG=v${VERSION_TAG}-sha-${GITHUB_SHA::8}-SNAPSHOT
fi
echo ::set-output name=versionTag::${VERSION_TAG}
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
# to speed up building process
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build