-
Notifications
You must be signed in to change notification settings - Fork 2
82 lines (72 loc) · 3.38 KB
/
release-maven-artifacts.yaml
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
name: Release Maven Artifacts
on:
workflow_dispatch:
inputs:
tag:
description: 'Release tag name'
required: true
release:
types: [released, prereleased]
env:
# The values are extracted from the github.event context,
# which is only available when the workflow gets triggered by a release event.
RELEASE_VERSION: ${{ github.event.release.name }}
BRANCH: ${{ github.event.release.target_commitish }}
jobs:
release-maven:
if: github.repository_owner == 'Apicurio'
runs-on: ubuntu-20.04
timeout-minutes: 30
env:
RELEASE_TYPE: release
steps:
- name: Fetch Release Details
if: github.event_name == 'workflow_dispatch'
run: |
touch release.json && curl https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/${{ github.event.inputs.tag }} > release.json
echo "RELEASE_VERSION=$(cat release.json | jq -r '.name')" >> $GITHUB_ENV
echo "BRANCH=$(cat release.json | jq -r '.target_commitish')" >> $GITHUB_ENV
- name: Download Source Code
run: |
git config --global user.name "apicurio-ci"
git config --global user.email "[email protected]"
git clone --branch $RELEASE_VERSION --single-branch https://apicurio-ci:${{ secrets.ACCESS_TOKEN }}@github.com/Apicurio/apicurio-unified-model-generator.git umg
# We have faced issues in the past where a github release was created from a wrong commit
# This step will ensure that the release was created from the right commit
- name: Verify Project Version
run: |
cd umg
PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
if [[ $PROJECT_VERSION != $RELEASE_VERSION ]]
then
echo "ERROR: Project Version '${PROJECT_VERSION}' does not match with Released Version '${RELEASE_VERSION}'"
exit 1
fi
- name: Set up settings.xml
run: |
pwd
mkdir -p /home/runner/.m2
chmod 755 /home/runner/.m2
echo "<settings><servers><server><id>${{ secrets.OSSRH_ID }}</id><username>${{ secrets.OSSRH_USERNAME }}</username><password>${{ secrets.OSSRH_TOKEN }}</password></server></servers><profiles><profile><id>${{ secrets.OSSRH_ID }}</id><activation><activeByDefault>true</activeByDefault></activation><properties><gpg.executable>gpg</gpg.executable><gpg.passphrase>${{ secrets.GPG_PASSPHRASE}}</gpg.passphrase></properties></profile></profiles></settings>" > /home/runner/.m2/settings.xml
cat /home/runner/.m2/settings.xml
- name: Import GPG Key
uses: crazy-max/ghaction-import-gpg@f6f458f535f4ccdf100400ee0755c0e857226a66
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Maven Deploy
uses: nick-fields/retry@v3
with:
timeout_minutes: 10
max_attempts: 5
retry_on: error
command: |
cd umg
mvn -e deploy -Prelease,!plugin-tests --batch-mode --settings /home/runner/.m2/settings.xml -DskipTests
- name: Google Chat Notification
if: ${{ failure() }}
uses: Co-qn/google-chat-notification@b9227d9daa4638c9782a5bd16c4abb86268127a1
with:
name: ${{ github.job }}
url: ${{ secrets.GOOGLE_CHAT_WEBHOOK }}
status: ${{ job.status }}