forked from EnigmaticaModpacks/Enigmatica2Expert
-
Notifications
You must be signed in to change notification settings - Fork 52
98 lines (84 loc) · 3.62 KB
/
cf-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
name: Publishing on CurseForge
on:
workflow_dispatch:
release:
types: [released]
jobs:
cf-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: release
uses: gregziegan/[email protected]
- name: 📃 Save changelog content to file
uses: DamianReeves/write-file-action@master
with:
path: latest_release.md
contents: ${{ steps.release.outputs.body }}
write-mode: overwrite
- uses: actions/setup-node@v3
with:
node-version: 18
- name: 🖼️ Generate image from md
run: npx mdimg -i latest_release.md -o latest.png -w 800 --css githubDark
- name: 🖼️ ➡️ Send discord message
uses: MineBartekSA/discord-webhook@v2
with:
webhook: ${{ secrets.WEBHOOK_URL }}
username: 🚀 New release
avatar_url: https://media.forgecdn.net/avatars/820/88/638200951256555174.png
embed: |
- title: __**${{ steps.release.outputs.name }}**__
url: ${{ steps.release.outputs.html_url }}
attachment: |
file: latest.png
continue-on-error: true
- run: npm i --omit=dev
- name: 📋 Generate html instead of markdown
run: node dev/lib/curseforge-md-to-html.js latest_release.md
- name: ⤵️ Prepend Header to HTML
run: |
echo -e '<p><a href="https://github.com/Krutoy242/Enigmatica2Expert-Extended/releases">Changelog</a> ● <a href="https://github.com/Krutoy242/Enigmatica2Expert-Extended/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3Abug">Known Bugs</a> ● <a href="https://github.com/Krutoy242/Enigmatica2Expert-Extended#considerations-before-updating">Update Caution</a></p>' | cat - latest_release.html > temp && mv temp latest_release.html
- name: 📋 Get content of changelog html
id: latest_html
uses: andstor/file-reader-action@v1
with:
path: latest_release.html
- name: 💽 Download .zip files from latest release
uses: robinraju/[email protected]
with:
latest: true
fileName: '*.zip'
- name: 🅱 Determine release type
id: release_type
run: |
if [[ "${{ steps.release.outputs.tag_name }}" == *"-beta"* ]]; then
echo "release_type=beta" >> $GITHUB_ENV
elif [[ "${{ steps.release.outputs.tag_name }}" == *"-alpha"* ]]; then
echo "release_type=alpha" >> $GITHUB_ENV
else
echo "release_type=release" >> $GITHUB_ENV
fi
- name: 💻 Upload Client
uses: itsmeow/curseforge-upload@v3
id: client
with:
release_type: ${{ env.release_type }}
display_name: 'E2E-Extended-${{ steps.release.outputs.tag_name }}'
file_path: 'E2E-Extended-${{ steps.release.outputs.tag_name }}.zip'
game_endpoint: minecraft
game_versions: 'Minecraft 1.12:1.12.2'
project_id: '561105'
token: '${{ secrets.CURSEFORGE_API_TOKEN }}'
changelog_type: html
changelog: '${{ steps.latest_html.outputs.contents }}'
- name: 🖥️ Upload Server
uses: itsmeow/curseforge-upload@v3
with:
release_type: ${{ env.release_type }}
display_name: 'E2E-Extended-${{ steps.release.outputs.tag_name }}-server'
file_path: 'E2E-Extended-${{ steps.release.outputs.tag_name }}-server.zip'
game_endpoint: minecraft
project_id: '561105'
parent_file_id: ${{ steps.client.outputs.id }}
token: '${{ secrets.CURSEFORGE_API_TOKEN }}'