Manual Build and Publish #1
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
# Credit by https://github.com/Madis0/sodium-fabric-translations | |
name: 'Manual Build and Publish' | |
on: [workflow_dispatch] | |
permissions: | |
contents: write | |
jobs: | |
version: | |
name: Bump Version | |
runs-on: ubuntu-latest | |
outputs: | |
tag: '${{ steps.bump.outputs.new_tag }}' | |
changelog: '${{ steps.bump.outputs.changelog }}' | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Get Latest Commit SHA | |
id: commit_sha | |
run: | | |
git fetch --depth=1 origin +refs/heads/${GITHUB_REF#refs/heads/}:refs/remotes/origin/${GITHUB_REF#refs/heads/} | |
echo "sha=$(git rev-parse origin/${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT | |
- name: Bump version and push tag | |
id: bump | |
uses: mathieudutour/github-tag-action@v6.1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
commit_sha: ${{ steps.commit_sha.outputs.sha }} | |
default_bump: minor | |
tag_prefix: v | |
publish: | |
name: Build Resource Pack | |
runs-on: ubuntu-latest | |
needs: | |
- version | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
with: | |
ref: '${{ needs.version.outputs.tag }}' | |
- name: Create Resource Pack File | |
run: (cd Flashback\ Translations && zip -r "../FlashbackTranslations.zip" *) | |
- name: Generate Checksum | |
run: >- | |
sha1sum "FlashbackTranslations.zip" | cut -d " " -f 1 > | |
"FlashbackTranslations.zip.sha1" | |
- name: Store Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Resource Pack | |
path: FlashbackTranslations.zip* | |
- name: Release on GitHub | |
id: release-step | |
uses: softprops/action-gh-release@v0.1.15 | |
with: | |
tag_name: '${{ needs.version.outputs.tag }}' | |
generate_release_notes: true | |
files: FlashbackTranslations.zip* | |
- name: Fetch Latest Minecraft Release | |
id: fetch-mc-release | |
run: | | |
curl -o minecraft.json https://piston-meta.mojang.com/mc/game/version_manifest_v2.json && echo "minecraftVersion=$(cat minecraft.json)" >> $GITHUB_OUTPUT | |
- name: Release on GitHub and Modrinth | |
uses: Kir-Antipov/mc-publish@v3.3 | |
with: | |
modrinth-id: gijmJRn4 | |
modrinth-token: '${{ secrets.MODRINTH_TOKEN }}' | |
name: 'Flashback Translations ${{ needs.version.outputs.tag }}' | |
version: '${{ needs.version.outputs.tag }}' | |
version-type: release | |
changelog: '${{ needs.version.outputs.changelog }}' | |
loaders: minecraft | |
game-versions: | | |
>=1.20 <=${{ fromJson(steps.fetch-mc-release.outputs.minecraftVersion).latest.release }} | |
game-version-filter: releases | |
files: | | |
FlashbackTranslations.zip | |
dependencies: | | |
Flashback(required){modrinth:4das1Fjq}#(ignore:github) |