Skip to content

Commit 01120ce

Browse files
merged the workflows
1 parent 651235a commit 01120ce

File tree

2 files changed

+29
-50
lines changed

2 files changed

+29
-50
lines changed
Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
name: Publish to GitHub Packages
1+
name: Build and upload
22

33
on:
4+
push:
5+
pull_request:
6+
types:
7+
- opened
8+
- reopened
9+
workflow_dispatch:
410
release:
511
types:
6-
- published
7-
push:
8-
branches:
9-
- new-command-system-1.20.6-2
12+
- created
1013

1114
env:
1215
USERNAME: ${{ github.actor }}
@@ -17,8 +20,7 @@ jobs:
1720
build:
1821
runs-on: ubuntu-latest
1922
permissions:
20-
contents: write
21-
packages: write
23+
contents: read
2224
steps:
2325
- name: Get current date
2426
run: echo "WLIB_BUILD_DATE=$(date +'%Y-%m-%d_%H-%M-%S')" >> "$GITHUB_ENV"
@@ -40,13 +42,31 @@ jobs:
4042
path: "**/build/libs/*.jar"
4143
name: WLib-${{ env.WLIB_BUILD_DATE }}
4244
if-no-files-found: error
45+
publish:
46+
runs-on: ubuntu-latest
47+
permissions:
48+
contents: write
49+
packages: write
50+
if: ${{ github.event_name != 'pull_request' }}
51+
steps:
52+
- name: Get current date
53+
run: echo "WLIB_BUILD_DATE=$(date +'%Y-%m-%d_%H-%M-%S')" >> "$GITHUB_ENV"
54+
- name: Get snapshot number
55+
run: echo "WLIB_SNAPSHOT_NUMBER=$((${{ github.run_number }}+${{ github.run_attempt }}))" >> $GITHUB_ENV
56+
- uses: actions/checkout@v4
57+
- name: Set up JDK 21
58+
uses: actions/setup-java@v4
59+
with:
60+
java-version: 21
61+
distribution: temurin
62+
- name: Setup Gradle
63+
uses: gradle/actions/setup-gradle@v4
4364
- name: Upload to the release
44-
if: ${{ github.event_name == 'release' }}
4565
env:
4666
GH_TOKEN: ${{ github.token }}
4767
run: |
4868
for file in */build/libs/*.jar; do
4969
gh release upload ${{ github.event.release.tag_name }} $file
5070
done
5171
- name: Publish
52-
run: ./gradlew -Pskip_nms=true clean build publish
72+
run: ./gradlew -Pskip_nms=true clean build publish

.github/workflows/build.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)