forked from confluentinc/openmessaging-benchmark
-
Notifications
You must be signed in to change notification settings - Fork 6
78 lines (65 loc) · 2.75 KB
/
release.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
# This workflow will build a Java project with Maven
name: Release
on:
pull_request:
types: [closed]
paths:
- '.github/project.yml'
jobs:
release:
name: release
if: ${{github.event.pull_request.merged == true}}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: checkout
uses: actions/checkout@v2
- name: Retrieve Project Metadata
uses: radcortez/project-metadata-action@243817f1e0f2b4df4e012fc17efc45cff166425d
id: metadata
with:
metadata-file-path: '.github/project.yml'
local-file: true
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Setup Docker
uses: docker-practice/actions-setup-docker@v1
- name: Docker Permissions
run: |
/usr/bin/sudo gpasswd -a $USER docker
/usr/bin/sudo setfacl -m user:$USER:rw /var/run/docker.sock
/usr/bin/sudo service docker restart
- name: Cache m2 repo
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build and run Unit tests
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -b release
mvn -B release:prepare -DpushChanges=false -s settings.xml -Dgithub.token=${{ secrets.GITHUB_TOKEN }} -P docker -DreleaseVersion=${{ steps.metadata.outputs.current-version }} -DdevelopmentVersion=${{ steps.metadata.outputs.next-version }} -Ddocker.repo=${{ secrets.IMAGE_REPO_HOSTNAME }} -Ddocker.organization=${{ secrets.IMAGE_REPO_NAMESPACE }}
git checkout ${{github.base_ref}}
git rebase release
mvn -B release:perform -DlocalCheckout=true -s settings.xml -Dgithub.token=${{ secrets.GITHUB_TOKEN }}
- name: docker push
run: |
docker login -u="${{ secrets.IMAGE_REPO_USERNAME }}" -p="${{ secrets.IMAGE_REPO_PASSWORD }}" ${{ secrets.IMAGE_REPO_HOSTNAME }}
docker push ${{ secrets.IMAGE_REPO_HOSTNAME }}/${{ secrets.IMAGE_REPO_NAMESPACE }}/openmessaging-benchmark:${{ steps.project.outputs.version }}
- name: Push Release Tag
run: |
git push
git push --tags
- name: Create GitHub Release
uses: radcortez/milestone-release-action@98bd3321583e9bdbbe15c08fa4b2249371efaeaa
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
milestone-title: ${{ steps.metadata.outputs.current-version }}