-
-
Notifications
You must be signed in to change notification settings - Fork 74
80 lines (76 loc) · 2.42 KB
/
build-and-publish.yaml
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
name: Build and Publish
on:
workflow_dispatch:
push:
pull_request:
types:
- opened
- synchronize
jobs:
generate-artifact-name:
runs-on: self-hosted
outputs:
name: ${{ steps.name.outputs.name }}
steps:
- name: Generate Name
id: name
run: |
if [[ "${{ github.event_name }}" == 'pull_request' ]]; then
suffix="PR ${{ github.event.number }}"
else
ref="${{ github.ref }}"
ref="${ref#refs/heads/}"
suffix="${ref//\//-}"
fi
name="AdvancedPeripherals $suffix"
echo "name: $name"
echo "name=$name" >> "$GITHUB_OUTPUT"
build-and-test:
needs:
- generate-artifact-name
uses: IntelligenceModding/actions/.github/workflows/build-and-test.yaml@master
with:
build_name: ${{ needs.generate-artifact-name.outputs.name }}
pr: ${{ github.event_name == 'pull_request' && github.event.number || '' }}
check: ${{ github.event_name != 'push' }}
publish:
if: ${{ github.event_name == 'push' && contains(github.ref, 'release/') }}
runs-on: self-hosted
needs:
- build-and-test
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Download Builds
uses: actions/download-artifact@v4
with:
name: ${{ needs.build-and-test.outputs.artifact-name }}
path: build/libs
- name: Patch Changelog
run: ./gradlew patchChangelog
- name: Push Changelog Patch
run: |
git config user.name github-actions && \
git config user.email github-actions[bot]@users.noreply.github.com && \
git add CHANGELOG.md && \
git commit -m 'action: patchChangelog' && \
git push
- name: Publish Maven
env:
PUBLIC_REP_NAME: ${{ secrets.PUBLIC_REP_NAME }}
PUBLIC_REP_KEY: ${{ secrets.PUBLIC_REP_KEY }}
run: ./gradlew publishAllPublicationsToPublicRepository
- name: Github Release
env:
GITHUB_KEY: ${{ github.token }}
run: ./gradlew githubRelease
- name: Publish Modrinth
env:
MODRINTH_KEY: ${{ secrets.MODRINTH_KEY }}
run: ./gradlew modrinth
- name: Publish CurseForge
env:
CURSEFORGE_KEY: ${{ secrets.CURSEFORGE_KEY }}
run: ./gradlew publishCurseForge