-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (44 loc) · 1.68 KB
/
push.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
name: Run tests and publish snapshot to Maven on push
on: [push]
jobs:
test_and_publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
loader: [forge, fabric, common]
env:
MOREMCMETA_MAVEN_USER: ${{ secrets.MOREMCMETA_MAVEN_USER }}
MOREMCMETA_MAVEN_PASS: ${{ secrets.MOREMCMETA_MAVEN_PASS }}
steps:
- uses: actions/checkout@3ba5ee6fac7e0e30e2ea884e236f282d3a775891
- uses: actions/setup-java@308abcba03229002f0055e17d79d00c32fca160f
with:
java-version: 21
distribution: temurin
- name: Determine mod version from branch or tag name
id: mod_version
uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0
with:
script: |
const ref = context.payload.ref;
const branchOrTag = ref.substring(ref.lastIndexOf('/') + 1);
return branchOrTag + '-prerelease';
result-encoding: string
- name: Ensure Gradle wrapper is executable
run: chmod +x ./gradlew
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@9aa31f26bc8e536d1faf4b332bb8365350743a18
- name: Run tests
uses: gradle/gradle-build-action@cfc50b189af149aeb55f94103f47753382d88d33
with:
arguments: test
- name: Publish snapshot to GitHub Packages
uses: gradle/gradle-build-action@cfc50b189af149aeb55f94103f47753382d88d33
with:
arguments: :${{ matrix.loader }}:build :${{ matrix.loader }}:publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MOD_VERSION: ${{ steps.mod_version.outputs.result }}