136 lines (119 loc) · 4.1 KB
/
pull-request-labeled-closed.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
133
134
135
136
name: Prepare Release Candidate for Release
on:
pull_request:
types:
- closed
jobs:
verify:
name: Verify Closed PR is Release Candidate
runs-on: ubuntu-latest
if: |
${{ github.ref == 'main' }} &&
${{ github.event.pull_request.merged }} &&
contains( github.event.pull_request.labels.*.name, 'Extension Release Candidate :rocket:' )
steps:
- run: echo "Starting Release ... "
build:
needs: [verify]
name: Build Artifact
runs-on: ubuntu-latest
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 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
server-id: sonatype-nexus-staging
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_SECRET }}
gpg-passphrase: GPG_PASSPHRASE
- name: Build With Maven
run: mvn clean install -Dmaven.test.skip
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.SONATYPE_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: liquibase-hibernate5
path: target/*.jar
draft-release:
needs: [ build ]
name: Draft Release
runs-on: ubuntu-latest
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 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Set Version Tag ENV from POM
run: ./.github/set-version-from-pom.sh
- run: echo ::set-output name=version::$VERSION_TAG
id: version
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
name: liquibase-hibernate5
- name: Release
uses: softprops/action-gh-release@v1
with:
target_commitish: ${{ github.sha }}
name: v${{ steps.version.outputs.version }}
tag_name: liquibase-hibernate5-${{ steps.version.outputs.version }}
draft: true
body: Support for Liquibase ${{ steps.version.outputs.version }}.
files: liquibase-hibernate5-*.jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
bump-pom-to-snapshot:
name: Prepare POM for Development
runs-on: ubuntu-latest
needs: [ draft-release ]
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: Configure git user
run: |
git config user.name "liquibot"
git config user.email "liquibot@liquibase.org"
- name: Bump POM Version for Development
run: |
mvn versions:set -DnextSnapshot=true
git add pom.xml
git commit -m "Version Bumped to Snapshot for Developent"
git push "https://liquibot:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git" HEAD:${{ github.base_ref }} --follow-tags --tags
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}