1+ name : sdk-java Release
2+
3+ on :
4+ pull_request :
5+ types : [closed]
6+ paths :
7+ - ' .github/project.yml'
8+
9+ jobs :
10+ release :
11+ runs-on : ubuntu-latest
12+ name : release
13+ if : ${{github.event.pull_request.merged == true}}
14+
15+ steps :
16+ - uses : radcortez/project-metadata-action@main
17+ name : Retrieve project metadata
18+ id : metadata
19+ with :
20+ github-token : ${{secrets.GITHUB_TOKEN}}
21+ metadata-file-path : ' .github/project.yml'
22+
23+ - uses : actions/checkout@v3
24+
25+ - name : Import GPG key
26+ id : import_gpg
27+ uses : crazy-max/ghaction-import-gpg@v5
28+ with :
29+ gpg_private_key : ${{ secrets.GPG_PRIVATE_KEY }}
30+ passphrase : ${{ secrets.GPG_PASSPHRASE }}
31+
32+ - name : Set up JDK 11
33+ uses : actions/setup-java@v3
34+ with :
35+ distribution : temurin
36+ java-version : 11
37+
38+ - name : Cache local Maven repository
39+ uses : actions/cache@v3
40+ with :
41+ path : ~/.m2/repository
42+ key : ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
43+ restore-keys : |
44+ ${{ runner.os }}-maven-
45+
46+ - name : Configure Git author
47+ run : |
48+ git config --local user.email "action@github.com"
49+ git config --local user.name "GitHub Action"
50+
51+ - name : Maven release ${{steps.metadata.outputs.current-version}}
52+ run : |
53+ gpg --quiet --batch --yes --decrypt --passphrase="${{secrets.GPG_PASSPHRASE}}" --output /tmp/maven-settings.xml .github/release/maven-settings.xml.gpg
54+ git checkout -b release
55+ mvn -B release:prepare -Prelease -DreleaseVersion=${{steps.metadata.outputs.current-version}} -DdevelopmentVersion=${{steps.metadata.outputs.next-version}} -s /tmp/maven-settings.xml
56+ git checkout ${{github.base_ref}}
57+ git rebase release
58+ mvn -B release:perform -Darguments=-DperformRelease -DperformRelease -Prelease -s /tmp/maven-settings.xml
59+
60+ - name : Push changes to ${{github.base_ref}}
61+ uses : ad-m/github-push-action@v0.6.0
62+ with :
63+ github_token : ${{ secrets.GITHUB_TOKEN }}
64+ branch : ${{github.base_ref}}
65+
66+ - name : Push tags
67+ uses : ad-m/github-push-action@v0.6.0
68+ with :
69+ github_token : ${{ secrets.GITHUB_TOKEN }}
70+ tags : true
71+ branch : ${{github.base_ref}}
0 commit comments