forked from apache/atlas
-
Notifications
You must be signed in to change notification settings - Fork 10
132 lines (115 loc) · 4.37 KB
/
maven.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: Java CI with Maven
on:
push:
branches:
- alpha
- beta
- development
- master
- staging
- lineageondemand
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/build.sh') }}
restore-keys: ${{ runner.os }}-m2
- name: Get branch name
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: get_branch
- name: Build with Maven
run: |
branch_name=${{ steps.get_branch.outputs.branch }}
if [[ $branch_name == 'main' || $branch_name == 'master' || $branch_name == 'lineageondemand' ]]
then
echo "build without dashboard"
chmod +x ./build.sh && ./build.sh build_without_dashboard
else
echo "build with dashboard"
chmod +x ./build.sh && ./build.sh
fi
- run: echo "REPOSITORY_NAME=`echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//"`" >> $GITHUB_ENV
shell: bash
- name: Get version tag
run: echo "##[set-output name=version;]$(echo `git ls-remote https://${{ secrets.my_pat }}@github.com/atlanhq/${REPOSITORY_NAME}.git refs/heads/${{ steps.get_branch.outputs.branch }} | awk '{ print $1}' | cut -c1-7`)abcd"
id: get_version
- name: Set up Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: $GITHUB_ACTOR
password: ${{ secrets.my_pat }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
no-cache: true
sbom: true
provenance: true
push: true
tags: |
ghcr.io/atlanhq/${{ github.event.repository.name }}-${{ steps.get_branch.outputs.branch }}:latest
ghcr.io/atlanhq/${{ github.event.repository.name }}-${{ steps.get_branch.outputs.branch }}:${{ steps.get_version.outputs.version }}
- name: Scan Image
uses: aquasecurity/trivy-action@master
with:
image-ref: 'ubuntu:18.04'
vuln-type: 'os,library'
format: 'sarif'
output: 'trivy-image-results.sarif'
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/[email protected]
with:
sarif_file: 'trivy-image-results.sarif'
- name: Check out into atlan repo
uses: actions/checkout@v2
with:
ref: ${{ steps.get_branch.outputs.branch }}
repository: atlanhq/atlan
token: ${{ secrets.my_pat }}
- name: Add Changelog
run: |
mkdir -p gitlog
echo "- ${{ github.event.head_commit.message }}">>gitlog/${{ github.event.repository.name }}.txt
chmod +x ./scripts/create_changelog.sh
./scripts/create_changelog.sh
- name: Commit changes
uses: EndBug/add-and-commit@v7
with:
branch: ${{ steps.get_branch.outputs.branch }}
author_name: atlan-ci
author_email: [email protected]
message: '${{ github.event.repository.name }}'
default_author: user_info
push: origin ${{ steps.get_branch.outputs.branch }}