Continuous Deployment #4
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: Continuous Deployment | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Version of the resource pack' | |
required: true | |
default: '1.0' | |
mc_version: | |
description: 'Minecraft version(s) the resource pack works in' | |
required: true | |
default: '1.14x-1.21x' | |
mc_version_range: | |
description: 'Minecraft version(s) the data pack runs in (encoded in version range spec)' | |
required: true | |
default: '>=1.14 <=1.21' | |
jobs: | |
create_data_pack: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
show-progress: false | |
- name: Extract tag | |
id: tag_version | |
run: echo "TAG_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
# Automatically set version numbers | |
- name: Find and replace uninstall file name | |
uses: jacobtomlinson/gha-find-replace@v3 | |
with: | |
find: "${file_name}" | |
replace: ${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ github.event.inputs.mc_version }}-datapack.zip | |
regex: false | |
include: "**uninstall.mcfunction" | |
- name: Find and replace data pack version | |
uses: jacobtomlinson/gha-find-replace@v3 | |
with: | |
find: "${version}" | |
replace: ${{ github.event.inputs.tag }} | |
regex: false | |
- name: Find and replace supported mc versions | |
uses: jacobtomlinson/gha-find-replace@v3 | |
with: | |
find: "${mc_version}" | |
replace: ${{ github.event.inputs.mc_version }} | |
regex: false | |
# Check for existence of datapack, mod and/or resourcepack folders. | |
- name: Check for data folder | |
id: check_datapack_folder | |
uses: andstor/file-existence-action@v3 | |
with: | |
files: "data" | |
- name: Check for mod folders | |
id: check_mod_folder | |
uses: andstor/file-existence-action@v3 | |
with: | |
files: "META-INF, net, fabric.mod.json, assets" | |
- name: Check for resource pack folder | |
id: check_assets_folder | |
uses: andstor/file-existence-action@v3 | |
with: | |
files: "assets/minecraft" | |
# Package project | |
- name: Create data pack zip file | |
uses: montudor/action-zip@v1 | |
if: steps.check_datapack_folder.outputs.files_exists == 'true' | |
with: | |
args: zip -qq "${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ github.event.inputs.mc_version }}-datapack.zip" -r data pack.mcmeta pack.png LICENSE README.md | |
- name: Create mod jar file | |
uses: montudor/action-zip@v1 | |
if: steps.check_mod_folder.outputs.files_exists == 'true' | |
with: | |
args: zip -qq "${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ github.event.inputs.mc_version }}-mod.jar" -r data assets META-INF net fabric.mod.json pack.mcmeta pack.png LICENSE README.md | |
- name: Create asset pack zip file | |
uses: montudor/action-zip@v1 | |
if: steps.check_assets_folder.outputs.files_exists == 'true' | |
with: | |
args: zip -qq "${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ github.event.inputs.mc_version }}-resourcepack.zip" -r assets pack.mcmeta pack.png LICENSE README.md | |
# Upload | |
- name: Upload resource pack to Modrinth | |
uses: Kir-Antipov/[email protected] | |
if: steps.check_assets_folder.outputs.files_exists == 'true' | |
with: | |
modrinth-id: ivUZsvzp | |
modrinth-token: ${{ secrets.MODRINTH_TOKEN }} | |
game-versions: ${{ github.event.inputs.mc_version_range }} | |
fail-mode: skip | |
name: "Better Flame Particles v${{ github.event.inputs.tag }}" | |
version: ${{ github.event.inputs.tag }} | |
changelog-file: CHANGES.md | |
files: | | |
./${{ github.event.repository.name }}-*.zip | |
- name: Upload resource pack to CurseForge | |
uses: Kir-Antipov/[email protected] | |
if: steps.check_assets_folder.outputs.files_exists == 'true' | |
with: | |
curseforge-id: 782814 | |
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} | |
game-versions: ${{ github.event.inputs.mc_version_range }} | |
fail-mode: skip | |
name: "Better Flame Particles v${{ github.event.inputs.tag }}" | |
version: ${{ github.event.inputs.tag }} | |
changelog-file: CHANGES.md | |
loaders: | | |
vanilla | |
files: | | |
./${{ github.event.repository.name }}-*.zip | |
- name: Add changelog header for GitHub release | |
run: sed -i '1i_Changelog:_' CHANGES.md | |
- name: Upload outputs to GitHub releases | |
uses: Kir-Antipov/[email protected] | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
github-tag: v${{ github.event.inputs.tag }} | |
game-versions: ${{ github.event.inputs.mc_version_range }} | |
name: Release v${{ github.event.inputs.tag }} | |
version: v${{ github.event.inputs.tag }} | |
changelog-file: CHANGES.md | |
files: | | |
./${{ github.event.repository.name }}-*.@(zip|jar) |