-
Notifications
You must be signed in to change notification settings - Fork 20
68 lines (64 loc) · 2.7 KB
/
gradle.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Provisioning App Build
on: [ push, pull_request ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Install NPM
run: cd client && npm install
- name: Build provisioning-app FE
run: cd client && npm run build:prod
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
distribution: 'adopt' # See 'Supported distributions' for available options
java-version: '11'
- name: Build provisioning-app BE (copy the FE artifacts to 'build/resources/main/static/nfe')
run: ./gradlew clean spotlessCheck build
env:
NO_NEXUS: true
- uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build docker image
if: success()
run: |
COMMIT_SHA=$(git show --format="%H" --no-patch)
COMMIT_AUTHOR=$(git --no-pager show -s --format='%an (%ae)' $COMMIT_SHA)
COMMIT_MESSAGE=$(git log -1 --pretty=%B $COMMIT_SHA)
COMMIT_TIME=$(git show -s --format=%ci $COMMIT_SHA)
BUILD_TIME=$(date -u "+%Y-%m-%d %H:%M:%S %z")
echo "GITHUB_REF=$GITHUB_REF" \
echo "COMMIT_AUTHOR=$COMMIT_AUTHOR" \
echo "COMMIT_MESSAGE=$COMMIT_MESSAGE" \
echo "COMMIT_SHA=$COMMIT_SHA" \
echo "GITHUB_SHA=$GITHUB_SHA" \
echo "COMMIT_TIME=$COMMIT_TIME" \
echo "GITHUB_REPOSITORY=$GITHUB_REPOSITORY" \
echo "BUILD_TIME=$BUILD_TIME"
docker build \
--label "ods.build.job.url=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \
--label "ods.build.source.repo.ref=$GITHUB_REF" \
--label "ods.build.source.repo.commit.author=$COMMIT_AUTHOR" \
--label "ods.build.source.repo.commit.msg=$COMMIT_MESSAGE" \
--label "ods.build.source.repo.commit.sha=$COMMIT_SHA" \
--label "ods.build.source.repo.commit.timestamp=$COMMIT_TIME" \
--label "ods.build.source.repo.url=https://github.com/$GITHUB_REPOSITORY.git" \
--label "ods.build.timestamp=$BUILD_TIME" \
-t ods-provisioning-app:local .
docker inspect ods-provisioning-app:local --format='{{.Config.Labels}}'
working-directory: docker
- name: Push docker image
if: success() && github.repository == 'opendevstack/ods-provisioning-app' && github.event_name == 'push'
shell: bash
env:
DOCKER_USER: ${{ secrets.DockerHubUser }}
DOCKER_PASS: ${{ secrets.DockerHubPass }}
run: ./.github/workflows/push-image.sh ${{ github.ref }} "$DOCKER_USER" "$DOCKER_PASS"