forked from runelite/plugin-hub
-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (126 loc) · 4.31 KB
/
build.yml
File metadata and controls
127 lines (126 loc) · 4.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
on:
workflow_dispatch:
inputs:
FORCE_BUILD:
description: "List of plugins to build, or 'ALL'"
required: false
COMMIT_RANGE:
description: "Commit range to build 1234abc..5689def"
required: false
API_FILES_VERSION:
description: "RuneLite version to use .api files from"
required: false
push:
pull_request:
permissions:
contents: read
jobs:
build:
# any forks that predate this repo having an action will have actions
# enabled by default, which will fail in a lot of cases because the branch
# is new, which makes the differential build fail
if: github.event_name != 'push' || github.repository_owner == 'runelite'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
path: plugin-hub
persist-credentials: false
- uses: actions/setup-java@v5
with:
distribution: adopt
java-version: 11
- name: fetch packager
env:
PACKAGER_URL: "https://github.com/runelite/plugin-hub-tooling/releases/download/v1/bundle.tar.zst"
run: |
set -exu
curl --location --fail --retry 4 --max-time 30 --output bundle.tar.zst "$PACKAGER_URL"
sha256sum bundle.tar.zst
tar xf bundle.tar.zst
- uses: actions/cache/restore@v5
id: restore-cache
with:
path: |
~/.gradle/caches/
api/
key: deps-${{ hashFiles('plugin-hub/runelite.version', 'bundle.tar.zst') }}
- name: prepare
if: steps.restore-cache.outputs.cache-hit != 'true'
run: ./prepare.sh
- uses: actions/cache/save@v5
if: steps.restore-cache.outputs.cache-hit != 'true'
with:
path: ~/.gradle/caches/
key: ${{ steps.restore-cache.outputs.cache-primary-key }}
- name: build
env:
REPO_CREDS: ${{ secrets.REPO_CREDS }}
REPO_ROOT: ${{ secrets.REPO_ROOT }}
# workflow_dispatch
FORCE_BUILD: ${{ github.event.inputs.FORCE_BUILD }}
COMMIT_RANGE: ${{ github.event.inputs.COMMIT_RANGE }}
API_FILES_VERSION: ${{ github.event.inputs.API_FILES_VERSION }}
# push
COMMIT_BEFORE: ${{ github.event.before }}
COMMIT_AFTER: ${{ github.event.after }}
# pull_request
PR_BEFORE: ${{ github.event.pull_request.base.sha }}
PR_AFTER: ${{ github.event.pull_request.head.sha }}
PACKAGE_IS_PR: ${{ github.event_name == 'pull_request' }}
run: |
COMMAND_SECRET="$(openssl rand -hex 32)"
echo "::add-mask::$COMMAND_SECRET"
echo "::stop-commands::$COMMAND_SECRET"
if $PACKAGE_IS_PR; then
export PACKAGE_COMMIT_RANGE="$PR_BEFORE...$PR_AFTER"
else
export PACKAGE_COMMIT_RANGE="${COMMIT_RANGE:-${COMMIT_BEFORE:+$COMMIT_BEFORE...$COMMIT_AFTER}}"
fi
exec java -XX:+UseParallelGC -cp package.jar net.runelite.pluginhub.packager.Packager
- uses: actions/upload-artifact@v4
with:
name: manifest_diff
path: /tmp/manifest_diff
retention-days: 1
- uses: actions/upload-artifact@v4
if: ${{ github.event_name == 'pull_request' }}
with:
name: jars
path: /tmp/jars
retention-days: 4
upload:
if: (github.event_name != 'push' || github.repository_owner == 'runelite') && github.event_name != 'pull_request'
needs: build
concurrency: upload
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 1
path: plugin-hub
persist-credentials: false
- name: fetch packager
env:
PACKAGER_URL: "https://github.com/runelite/plugin-hub-tooling/releases/download/v1/bundle.tar.zst"
run: |
set -exu
curl --location --fail --retry 4 --max-time 30 --output bundle.tar.zst "$PACKAGER_URL"
sha256sum bundle.tar.zst
tar xf bundle.tar.zst
- uses: actions/setup-java@v5
with:
distribution: adopt
java-version: 11
- uses: actions/download-artifact@v4
with:
name: manifest_diff
path: /tmp
- name: upload
env:
REPO_CREDS: ${{ secrets.REPO_CREDS }}
REPO_ROOT: ${{ secrets.REPO_ROOT }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
run: |
exec java -XX:+UseParallelGC -cp upload.jar net.runelite.pluginhub.uploader.Uploader