94 lines (83 loc) · 3.44 KB
/
pull-request.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
name: Run Unit Tests
on:
pull_request:
types:
- opened
- reopened
- synchronize
jobs:
unit-test:
name: Java ${{ matrix.java }}
runs-on: ubuntu-latest
# Only run job if untagged as release. Will run for all PRs and release PRs during the first run.
if: ${{ !contains( github.event.pull_request.labels.*.name, 'Extension Release Candidate :rocket:' ) }}
strategy:
matrix:
java: [8, 11, 16]
steps:
- uses: actions/checkout@v2
- name: Cache Local Maven Repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java }}
distribution: 'adopt'
- name: Run Unit Tests With Maven
run: mvn surefire:test --file pom.xml
# This step is the automation to create a release based on a liquibase core bump
# If a manual release is required, the steps below will need to be done manually prior
# to adding the Release Candidate label.
label:
name: Label as Release Candidate
runs-on: ubuntu-latest
needs: [ unit-test ]
if: contains( github.event.pull_request.head.ref, 'dependabot/maven/org.liquibase-liquibase-core' )
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
- name: Cache Local Maven Repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Set Version Tag ENV
run: ./.github/set-version-from-head.sh ${{ github.event.pull_request.head.ref }}
- run: echo $VERSION_TAG
- name: Configure git user
run: |
git config user.name "liquibot"
git config user.email "liquibot@liquibase.org"
- name: Bump POM Version for Next Release
run: |
mvn versions:set -DnewVersion=$VERSION_TAG
git add pom.xml
git commit -m "Version Bumped to $VERSION_TAG"
git tag -a -m "Version Bumped to $VERSION_TAG" liquibase-hibernate5-$VERSION_TAG
git push "https://liquibot:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git" HEAD:${{ github.event.pull_request.head.ref }} --follow-tags --tags
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
- run: ./.github/add-label-to-pull-request.sh
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
GITHUB_ISSUE_URL: ${{ github.event.pull_request._links.issue.href }}
GITHUB_LABEL: "Extension Release Candidate :rocket:"
- run: ./.github/add-comment-to-pull-request.sh
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
GITHUB_ISSUE_URL: ${{ github.event.pull_request._links.issue.href }}
GITHUB_COMMENT: "<h2> ⚠️ Reminder</h2>Release Candidate pull requests will automatically release when merged.<br /><br />Please review and merge all other pull requests prior to merging this request."