-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (56 loc) · 2.21 KB
/
build_master.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
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Java CI with Maven
permissions:
id-token: write
contents: write
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build_on_master:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache the Maven packages to speed up build
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Declare some variables
id: vars
shell: bash
run: |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B -e -X clean install --file pom.xml -Drevision=${{ github.run_id }}.${{ steps.vars.outputs.sha_short }}
publish-job:
runs-on: ubuntu-latest
needs: [build_on_master]
steps:
- uses: actions/checkout@v2
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::329799773336:role/npiper-githubactions-role
aws-region: eu-west-2
- name: Declare some variables
id: vars2
shell: bash
run: |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Git config user as github-actions bot for tagging
uses: snow-actions/git-config-user@v1.0.0
- uses: actions/setup-java@v1
with:
java-version: 14
- run: mvn -e -B --file pom.xml -DskipTests site deploy scm:tag -Dgithub.global.userName=${{ secrets.GIT_USER_NAME}} -Dgithub.global.oauth2Token=${{ secrets.GIT_TOKEN}} -Drevision=${{ github.run_id }}.${{ steps.vars2.outputs.sha_short }}