Publishing on CurseForge #106
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }}' |