-
Notifications
You must be signed in to change notification settings - Fork 13
62 lines (53 loc) · 1.88 KB
/
deploy-tagged.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
name: Deploy tagged release
run-name: Deploying tagged release ${{ inputs.TAG != '' && format('refs/tags/{0}', inputs.TAG) || github.ref }}
on:
push:
# Pattern matched against refs/tags
tags:
- '*' # Only tags excluding "/" sign (i.e. 1.2.3, v1.2.3, etc)
workflow_dispatch:
inputs:
TAG:
required: true
description: The tag to build and publish (as is)
env:
TAG: ${{ inputs.TAG != '' && format('refs/tags/{0}', inputs.TAG) || github.ref }}
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ env.TAG }}
- name: Version check
run: |
REF=${{ env.TAG }}
VERSION=$(cat gradle.properties | grep -iE "version([ ]*)=" | cut -f 2 -d "=")
echo $REF
echo $VERSION
if [[ "$REF" != "refs/tags/$VERSION" && "$REF" != "refs/tags/v$VERSION" ]]; then
echo "Version mismatch - gradle.properties contains a different version than the git tag! Exiting!"
exit 1
fi
- name: Setup JDK and Maven
uses: actions/setup-java@v3
with:
java-version: 8
distribution: "temurin"
- name: Setup key
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
fingerprint: ${{ secrets.GPG_KEY_ID }}
passphrase: ${{ secrets.GPG_PASS }}
trust_level: 5
- name: Build and deploy
env:
UPLOADCARE_PUBLISH_SONATYPE_USER: "${{ secrets.UPLOADCARE_PUBLISH_SONATYPE_USER }}"
UPLOADCARE_PUBLISH_SONATYPE_PASS: "${{ secrets.UPLOADCARE_PUBLISH_SONATYPE_PASS }}"
run: ./gradlew build publish --warn --stacktrace
- name: Find signed files.
if: ${{ always() }}
run: |
find . -type f -name "*.asc"