-
Notifications
You must be signed in to change notification settings - Fork 5
139 lines (123 loc) · 6.84 KB
/
publish.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
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
128
129
130
131
132
133
134
135
136
137
138
139
# This workflow will export the modpack and then upload it to Modrinth
name: Publish Modpack
on:
push:
branches: [ "main", "paper-chan-optimized-plus" ]
workflow_dispatch:
jobs:
build:
# This just needs to run packwiz modrinth export
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache packwiz
id: cache-packwiz
uses: actions/cache@v3
with:
path: packwiz
key: ${{ runner.os }}-packwiz
- name: Download packwiz
if: steps.cache-packwiz.outputs.cache-hit != 'true'
run: |
wget -O packwiz.zip https://nightly.link/packwiz/packwiz/workflows/go/main/Linux%2064-bit%20x86.zip
unzip packwiz.zip
chmod +x packwiz
- name: Export modpack
run: ./packwiz modrinth export
- name: Upload modpack to GitHub
uses: actions/upload-artifact@v4
with:
name: Kami Chan Optimized
path: Kami Chan Optimized-*.mrpack
# Now we need to parse our pack.toml file to get some information
- name: Parse pack.toml version
uses: SebRollen/[email protected]
id: pack_version
with:
file: pack.toml
field: version
- name: Parse pack.toml minecraft version
uses: SebRollen/[email protected]
id: pack_minecraft
with:
file: pack.toml
field: versions.minecraft
- name: Publish to Modrinth (Main)
uses: Kir-Antipov/[email protected]
id: publish-main
# Only publish if we're on the main branch
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && (!contains(github.event.head_commit.message, '[skip ci]') || contains(github.event.head_commit.message, '[ci skip]')) && (!contains(github.event.head_commit.message, '[skip modrinth]') || contains(github.event.head_commit.message, '[ci skip modrinth]'))
with:
modrinth-id: sQ1MQcd2
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
modrinth-featured: true
modrinth-unfeature-mode: subset
modrinth-version: ${{ steps.pack_version.outputs.value }}
modrinth-version-type: release
# The files will be 'Kami Chan Optimized-w.x.y.z.mrpack' so just use that
files: '*.mrpack'
loaders: |
fabric
# For the name, it's always formatted as '[MC Version] - [Modpack Version]'
name: '${{ steps.pack_minecraft.outputs.value }} - ${{ steps.pack_version.outputs.value }}'
game-versions: |
${{ steps.pack_minecraft.outputs.value }}
- name: Publish to Modrinth (Plus)
uses: Kir-Antipov/[email protected]
id: publish-plus
# Only publish if we're on the main branch
if: github.ref == 'refs/heads/paper-chan-optimized-plus' && github.event_name != 'pull_request' && (!contains(github.event.head_commit.message, '[skip ci]') || contains(github.event.head_commit.message, '[ci skip]')) && (!contains(github.event.head_commit.message, '[skip modrinth]') || contains(github.event.head_commit.message, '[ci skip modrinth]'))
with:
modrinth-id: Ev7buduH
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
modrinth-featured: true
modrinth-unfeature-mode: subset
modrinth-version: ${{ steps.pack_version.outputs.value }}
modrinth-version-type: release
# The files will be 'Kami Chan Optimized-w.x.y.z.mrpack' so just use that
files: '*.mrpack'
loaders: |
fabric
# For the name, it's always formatted as '[MC Version] - [Modpack Version]'
name: '${{ steps.pack_minecraft.outputs.value }} - ${{ steps.pack_version.outputs.value }}'
game-versions: |
${{ steps.pack_minecraft.outputs.value }}
- name: Check for existing release
uses: insightsengineering/[email protected]
id: release-existence
with:
release-tag: ${{ steps.pack_version.outputs.value }}
- name: Create release
uses: softprops/action-gh-release@v1
# Don't attempt to re-release if the tag already exists
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && (!contains(github.event.head_commit.message, '[skip ci]') || contains(github.event.head_commit.message, '[ci skip]')) && steps.release-existence.outputs.release-exists != 'true'
with:
files: Kami Chan Optimized-*.mrpack
name: '${{ steps.pack_minecraft.outputs.value }} - ${{ steps.pack_version.outputs.value }}'
tag_name: '${{ steps.pack_version.outputs.value }}'
generate_release_notes: true
- name: Get current date in ISO 8601 format
id: date
run: echo "date=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_OUTPUT
- name: Announce on Discord (Main)
uses: tsickert/[email protected]
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && (!contains(github.event.head_commit.message, '[skip ci]') || contains(github.event.head_commit.message, '[ci skip]')) && (!contains(github.event.head_commit.message, '[skip modrinth]') || contains(github.event.head_commit.message, '[ci skip modrinth]'))
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK }}
username: Kami Chan
avatar-url: https://cdn.modrinth.com/data/sQ1MQcd2/16cd6db5088b78b41c29cda8eda940f5390efa08.png
embed-title: 'New Kami Chan Optimized update!'
embed-description: '${{ steps.pack_version.outputs.value }} is now available on Modrinth! [Click here to download](${{ steps.publish-main.outputs.modrinth-url }})'
embed-thumbnail-url: https://cdn.modrinth.com/data/sQ1MQcd2/16cd6db5088b78b41c29cda8eda940f5390efa08.png
embed-timestamp: '${{ steps.date.outputs.date }}'
- name: Announce on Discord (Plus)
uses: tsickert/[email protected]
if: github.ref == 'refs/heads/paper-chan-optimized-plus' && github.event_name != 'pull_request' && (!contains(github.event.head_commit.message, '[skip ci]') || contains(github.event.head_commit.message, '[ci skip]')) && (!contains(github.event.head_commit.message, '[skip modrinth]') || contains(github.event.head_commit.message, '[ci skip modrinth]'))
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK }}
username: Kami Chan
avatar-url: https://cdn.modrinth.com/data/Ev7buduH/90eb465b3f8068fde66e3a300891ddc44160c9d8.png
embed-title: 'New Kami Chan Optimized Plus update!'
embed-description: '${{ steps.pack_version.outputs.value }} is now available on Modrinth! [Click here to download](${{ steps.publish-plus.outputs.modrinth-url }})'
embed-thumbnail-url: https://cdn.modrinth.com/data/Ev7buduH/90eb465b3f8068fde66e3a300891ddc44160c9d8.png
embed-timestamp: '${{ steps.date.outputs.date }}'