-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (62 loc) · 2.13 KB
/
gradle-snapshot.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
63
64
65
name: Gradle Snapshot Package
on:
push:
branches:
- staging
- master
pull_request:
branches:
- master
- staging
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
# For stuff need our private packages
# USERNAME: ${{ secrets.SERVICE_ID }}
# TOKEN: ${{ secrets.SERVICE_PAT }}
# For stuff that doesn't need our private packages
USERNAME: ${{ github.actor }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
MC_VER: 1.16.5
PAPER_BUILD: 786
steps:
- name: Set SNAPSHOT version from latest release
run: |
echo "Fetching version information..."
tag=$(curl --silent "https://api.github.com/repos/${{ github.event.repository.full_name }}/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")')
echo "BASE_VERSION=${tag/v/}" >> $GITHUB_ENV
ts=$(date +%s)
echo "VERSION=${tag/v/}-SNAPSHOT-${ts}" >> $GITHUB_ENV
echo "Package version: ${tag/v/}-SNAPSHOT-${ts}"
- uses: actions/checkout@v2
- name: Set up JDK 16
uses: actions/setup-java@v2
with:
java-version: '16'
distribution: 'adopt'
server-id: github
cache: 'gradle'
settings-path: ${{ github.workspace }}
- name: Cache Paper NMS
id: "nms"
uses: "actions/cache@v2"
with:
path: ~/.m2/repository/com/destroystokyo/paper/paper
key: ${{ runner.os }}-nms-${{ env.MC_VER }}-${{ env.PAPER_BUILD }}
- name: Include Paper NMS
if: steps.nms.outputs.cache-hit != 'true'
run: |
echo "Downloading paper nms: version: ${MC_VER} build ${PAPER_BUILD}"
wget -O paper.jar -q https://papermc.io/api/v2/projects/paper/versions/${MC_VER}/builds/${PAPER_BUILD}/downloads/paper-${MC_VER}-${PAPER_BUILD}.jar
java -Dpaperclip.install=true -jar paper.jar
- name: Gradle build
run: gradle build
- name: Gradle test
run: gradle test
- name: Publish to GitHub Packages
run: gradle publish -PpublishZgpr=true