-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (44 loc) · 1.48 KB
/
main.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
name: Build and Deploy Spigot Plugin
on:
push:
branches:
- '*'
permissions:
contents: write
packages: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2 # Note: Use v2 here
- name: Set up JDK 17
uses: actions/setup-java@v2 # Note: Updated to v2 for easier setup
with:
java-version: '17'
distribution: 'temurin'
- name: Get latest release number
id: latestrelease
run: echo "RELEASE_VERSION=$(curl -s https://api.github.com/repos/$GITHUB_REPOSITORY/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | sed 's/[^0-9]*//g')" >> $GITHUB_ENV
- name: Calculate new release number
run: echo "NEW_RELEASE_VERSION=$((${RELEASE_VERSION} + 1))" >> $GITHUB_ENV
- name: Update pom.xml with new version
run: mvn versions:set -DnewVersion=$NEW_RELEASE_VERSION
- name: Clean with Maven
run: mvn clean
- name: Download Maven Dependencies
run: mvn dependency:resolve
- name: Test with Maven
run: mvn test
- name: Package with Maven
run: mvn package
- name: Create GitHub Release with new version
id: create_release
uses: actions/create-release@v1
with:
tag_name: v${{ env.NEW_RELEASE_VERSION }}
release_name: Release v${{ env.NEW_RELEASE_VERSION }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.RELEASE }}