Skip to content

feat: webhook alert #10

feat: webhook alert

feat: webhook alert #10

Workflow file for this run

# 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/toml-action@v1.2.0
id: pack_version
with:
file: pack.toml
field: version
- name: Parse pack.toml minecraft version
uses: SebRollen/toml-action@v1.2.0
id: pack_minecraft
with:
file: pack.toml
field: versions.minecraft
- name: Publish to Modrinth (Main)
uses: Kir-Antipov/mc-publish@v3.3
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/mc-publish@v3.3
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/release-existence-action@v1.0.0
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]'))
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/discord-webhook@v6.0.0
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/discord-webhook@v6.0.0
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 }}'