forked from chsami/Microbot
-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (86 loc) · 3.31 KB
/
release.yml
File metadata and controls
99 lines (86 loc) · 3.31 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Release
on:
push:
branches:
- main
env:
version: ${microbot.version}
jobs:
build:
runs-on: ubuntu-latest # You can choose a different runner if needed
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
- name: Build Shaded JAR
run: |
COMMIT_SHA=$(git rev-parse --short HEAD)
mvn clean package -Dmicrobot.commit.sha=$COMMIT_SHA
- name: Read microbot.version from POM
id: version
run: |
V=$(mvn -q -f runelite-client/pom.xml help:evaluate \
-Dexpression=microbot.version -DforceStdout)
# fallback to project.version if the property isn't defined
if [ -z "$V" ]; then
V=$(mvn -q -f runelite-client/pom.xml help:evaluate \
-Dexpression=project.version -DforceStdout)
fi
echo "version=$V" >> "$GITHUB_OUTPUT"
echo "Using version: $V"
- name: Create Release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{ steps.version.outputs.version }}"
prerelease: false
title: "Release ${{ steps.version.outputs.version }}"
files: |
/home/runner/work/Microbot/Microbot/runelite-client/target/microbot-*.jar
- name: Upload Jar to Hetzner
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.PROD_HOST }}
username: root
key: ${{ secrets.PROD_SSH_KEY }}
source: runelite-client/target/microbot-*.jar
target: /var/www/files/releases/microbot/stable/
strip_components: 2
- name: Set up Maven settings
run: |
mkdir -p ~/.m2
cat > ~/.m2/settings.xml <<EOL
<settings>
<servers>
<server>
<id>microbot-release</id>
<username>${{ secrets.NEXUS_USER }}</username>
<password>${{ secrets.NEXUS_PASSWORD }}</password>
</server>
</servers>
</settings>
EOL
- name: Deploy to Nexus
run: mvn deploy:deploy-file -DgroupId=com.microbot -DartifactId=client -Dversion=${{ steps.version.outputs.version }} -Dpackaging=jar -Dfile=runelite-client/target/microbot-${{ steps.version.outputs.version }}.jar -DrepositoryId=microbot-release -Durl=https://nexus.microbot.cloud/repository/microbot-release/
- name: Get Auth Token
id: auth
run: |
RESPONSE=$(curl -X POST \
-H "Content-Type: application/json" \
-d "{\"email\":\"${{ secrets.API_EMAIL }}\",\"password\":\"${{ secrets.API_PASSWORD }}\"}" \
https://microbot.cloud/api/auth/login)
TOKEN=$(echo $RESPONSE | jq -r '.token')
echo "token=$TOKEN" >> "$GITHUB_OUTPUT"
- name: Update API Version
run: |
curl -X PUT \
-H "Authorization: Bearer ${{ steps.auth.outputs.token }}" \
-H "Content-Type: application/json" \
-d "{\"version\":\"${{ steps.version.outputs.version }}\"}" \
https://microbot.cloud/api/version/client