-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (49 loc) · 1.95 KB
/
deploy.yml
File metadata and controls
60 lines (49 loc) · 1.95 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
name: Deploy to Negative Games Nexus (Gradle)
on:
push:
branches:
- release
- snapshot
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Configure Gradle / Nexus credentials
run: |
mkdir -p ~/.gradle
cat << 'EOF' > ~/.gradle/gradle.properties
nexusUsername=${{ secrets.NEXUS_USERNAME }}
nexusPassword=${{ secrets.NEXUS_PASSWORD }}
nexusSnapshotsUrl=https://repo.negative.games/repository/maven-snapshots
nexusReleasesUrl=https://repo.negative.games/repository/maven-releases
EOF
# Modify version for release branch (remove -SNAPSHOT)
- name: Modify version for release
if: github.ref == 'refs/heads/release'
run: |
find . -name "build.gradle.kts" -type f -exec sed -i "s/\\(var apiVersion = \\\"[^\\\"]*\\)-SNAPSHOT\\\"/\\1\\\"/" {} +
# Modify version for snapshot branch (add -SNAPSHOT if not present)
- name: Modify version for snapshot
if: github.ref == 'refs/heads/snapshot'
run: |
find . -name "build.gradle.kts" -type f -exec sed -i "/var apiVersion = \\\".*-SNAPSHOT\\\"/! s/\\(var apiVersion = \\\"[^\\\"]*\\)\\\"/\\1-SNAPSHOT\\\"/" {} +
# Make gradlew executable
- name: Make gradlew executable
run: chmod +x ./gradlew
# Deploy to RELEASES on release branch
- name: Build and deploy release
if: github.ref == 'refs/heads/release'
run: ./gradlew clean publish -PisRelease=true
# Deploy to SNAPSHOTS on snapshot branch
- name: Build and deploy snapshot
if: github.ref == 'refs/heads/snapshot'
run: ./gradlew clean publish -PisRelease=false