ci: release to other modding platforms #20
Workflow file for this run
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: Create Release | |
on: | |
push: | |
branches: | |
- 'main' | |
tags: | |
- '*.*.*' | |
workflow_dispatch: | |
permissions: | |
contents: write | |
discussions: write | |
pull-requests: write | |
jobs: | |
release: | |
name: Create Release | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
if: github.ref_type == 'tag' | |
steps: | |
# Checkout repository and include git LFS files | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
fetch-depth: 0 | |
lfs: true | |
# Download files from Git LFS and caches them to reduce bandwidth usage | |
- name: Cache and pull LFS files | |
uses: ./.github/actions/lfs | |
# Install PackWiz | |
- name: Install packwiz | |
uses: supplypike/setup-bin@v4 | |
with: | |
uri: 'https://nightly.link/packwiz/packwiz/workflows/go/main/Linux%2064-bit%20x86.zip' | |
name: 'packwiz' | |
version: 'linux' | |
# Update version fields in modpack configs | |
- name: Update version field in configs | |
uses: ./.github/actions/config | |
with: | |
version: ${{ github.ref_name }} | |
# Refresh packwiz files (Client) | |
- name: Refresh Packwiz Index Client | |
shell: bash | |
run: | | |
packwiz refresh | |
working-directory: ./main | |
# Commit and push updated files | |
- name: Update repository | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: ${{ github.ref_name }} | |
branch: main | |
# Package release (Client) | |
- name: Build CurseForge Client Modpack | |
shell: bash | |
run: | | |
packwiz curseforge export --output Optim-${{ github.ref_name }}.zip | |
working-directory: ./main | |
- name: Build Modrinth Client Modpack | |
shell: bash | |
run: | | |
packwiz modrinth export --output Optim-${{ github.ref_name }}.mrpack | |
working-directory: ./main | |
# Fetch modpack metadata from the modpack config | |
- name: Read Modpack Metadata | |
id: metadata | |
uses: ./.github/actions/meta | |
with: | |
working-directory: ./main | |
# Generate changelog | |
- name: Generate changelog | |
uses: ardalanamini/auto-changelog@v4 | |
id: changelog | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
commit-types: | | |
feat: New Features | |
remove: Removed Features | |
fix: Bug Fixes | |
build: Build System & Dependencies | |
perf: Performance Improvements | |
docs: Documentation | |
test: Tests | |
refactor: Refactors | |
chore: Chores | |
ci: CI | |
style: Code Style | |
revert: Reverts | |
default-commit-type: Other Changes | |
release-name: ${{ github.ref_name }} | |
mention-authors: true | |
mention-new-contributors: true | |
include-compare-link: false | |
include-pr-links: true | |
include-commit-links: true | |
semver: true | |
use-github-autolink: true | |
# Create release | |
- name: Create Release Client (GitHub) | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
./main/Optim-${{ github.ref_name }}.zip | |
./main/Optim-${{ github.ref_name }}.mrpack | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag_name: ${{ github.ref_name }} | |
draft: true | |
prerelease: false | |
generate_release_notes: false | |
body: ${{ steps.changelog.outputs.changelog }} | |
- name: Create Release Client (Modrinth) | |
uses: ./.github/actions/release | |
with: | |
working-directory: ./main | |
version: ${{ github.ref_name }} | |
mod-loader: ${{ steps.metadata.outputs.mod-loader }} | |
minecraft-version: ${{ steps.metadata.outputs.minecraft-version }} | |
modrinth: true | |
curseforge: true | |
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} | |
MODRINTH_ID: ${{ secrets.MODRINTH_ID }} | |
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} | |
CURSEFORGE_ID: ${{ secrets.CURSEFORGE_ID }} | |
changelog: ${{ steps.changelog.outputs.changelog }} |