-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (56 loc) · 1.86 KB
/
publish.yml
File metadata and controls
69 lines (56 loc) · 1.86 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
name: Publish Release
run-name: "Publish release from ${{ github.ref_name }}"
on:
workflow_dispatch:
inputs:
distinct_id:
type: string
required: false
permissions:
# Needed to push the tag.
contents: write
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Echo distinct ID ${{ inputs.distinct_id }}
run: echo ${{ inputs.distinct_id }}
- name: Checkout repository
uses: actions/checkout@v6
with:
# Include all tags in case the new tag already exists.
fetch-tags: true
- name: Set up Java 25
uses: actions/setup-java@v5
with:
java-version: "25"
distribution: "microsoft"
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
- name: Build
run: ./gradlew build --stacktrace --warning-mode=fail
- name: Create and push tag
if: ${{ github.ref_type != 'tag' }}
run: |
VERSION=v$(grep "^version=" gradle.properties | cut -d'=' -f2 | tr -d ' \r')
git config --global user.name "Wurst-Bot"
git config --global user.email "contact.wurstimperium@gmail.com"
git tag "$VERSION"
git push origin "$VERSION"
- name: Publish to staging Maven repository
run: ./gradlew publishAllPublicationsToStagingRepository --stacktrace
- name: Set up SSH
run: |
mkdir -p ~/.ssh
chmod 700 ~/.ssh
printf '%s\n' "${{ secrets.MAVEN_DEPLOY_SSH_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
printf '%s\n' "${{ secrets.MAVEN_DEPLOY_KNOWN_HOSTS }}" > ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts
- name: Upload to Maven server
run: |
rsync -rlvz \
build/maven-repo/ \
"${{ secrets.MAVEN_DEPLOY_USER }}@${{ secrets.MAVEN_DEPLOY_HOST }}:"