-
Notifications
You must be signed in to change notification settings - Fork 5
84 lines (72 loc) · 3.04 KB
/
deploy.yml
File metadata and controls
84 lines (72 loc) · 3.04 KB
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
#
# Copyright 2018 ABSA Group Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: Deploy
on:
workflow_dispatch:
inputs:
tag-name:
description: 'Tag for deployment (e.g., v0.5.2)'
required: true
jobs:
deploy:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for all tags and branches
- name: Validate format of received tag
uses: actions/github-script@v7
with:
script: |
const newTag = core.getInput('tag-name');
const regex = /^v[0-9]+\.[0-9]+\.[0-9]+$/;
if (!regex.test(newTag)) {
core.setFailed('Tag does not match the required format "v[0-9]+.[0-9]+.[0-9]+". Valid example: v0.5.2');
return;
}
tag-name: ${{ github.event.inputs.tag-name }}
- name: Define semantic version number
id: semantic_version
run: |
TAG_NAME="${{ github.event.inputs.tag-name }}"
VERSION=${TAG_NAME#v}
echo "VERSION=${VERSION}" >> "${GITHUB_ENV}"
- name: Checkout to tag
run: |
git checkout ${{ github.event.inputs.tag-name }}
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '8'
architecture: 'x64'
- name: Import GPG keys
run: |
echo "${{ secrets.MAVEN_GPG_PRIVATE_KEY }}" | base64 --decode | gpg --batch --import --keyserver https://keyserver.ubuntu.com/
echo "${{ secrets.MAVEN_GPG_PASSPHRASE }}" | gpg --passphrase-fd 0 --batch --pinentry-mode loopback --import-ownertrust <<< .
- name: Create settings.xml
run: |
echo "<settings xmlns=\"http://maven.apache.org/SETTINGS/1.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd\">
<servers>
<server>
<id>ossrh</id>
<username>${{ secrets.OSSRH_USERNAME }}</username>
<password>${{ secrets.OSSRH_TOKEN }}</password>
</server>
</servers>
</settings>" > $HOME/.m2/settings.xml
- name: Build and deploy artifact
run: mvn -B -e -DskipTests -Dmanual-release -Ddeploy -Dossrh clean deploy -Dossrh.username=${{ secrets.OSSRH_USERNAME }} -Dossrh.password=${{ secrets.OSSRH_TOKEN }} -Dgpg.passphrase=${{ secrets.MAVEN_GPG_PASSPHRASE }}