publish to Curseforge #12
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: publish to Curseforge | |
on: | |
workflow_dispatch: | |
inputs: | |
modpack-version: | |
description: 'Modpack Version' | |
required: true | |
default: '1.x.x' | |
env: | |
MINECRAFT_VERSION: 1.20 | |
PROJECT_NAME: "Sacred-Call" | |
PROJECT_ID: "896639" | |
CURSEFORGE_TOKEN: ${{ secrets.CF_API_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
# modpack-info: | |
# runs-on: ubuntu-latest | |
# outputs: | |
# projectname: ${{ steps.info.outputs.projectname }} | |
# version: ${{ steps.info.outputs.version }} | |
# tag: ${{ steps.version.outputs.tag }} | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v2 | |
# - name: Get modpack info | |
# id: info | |
# run: | | |
# manifestjson=`cat ./modpack/manifest.json` | |
# projectname=`echo $(jq -r '.name' <<< "$manifestjson")` | |
# echo "::set-output name=projectname::$projectname" | |
# version=`echo $(jq -r '.minecraft.version' <<< "$manifestjson")` | |
# echo "::set-output name=version::$version" | |
# - name: Get tag | |
# id: version | |
# uses: "WyriHaximus/github-action-get-previous-tag@v1" | |
changelog: | |
runs-on: ubuntu-latest | |
outputs: | |
changelog: ${{ steps.changelog.outputs.changelog }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Generate changelog | |
id: changelog | |
uses: heinrichreimer/github-changelog-generator-action@v2.1.1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
output: CHANGELOG.md | |
stripGeneratorNotice: true | |
- name: Store changelog | |
uses: actions/upload-artifact@v2 | |
with: | |
name: changelog | |
path: CHANGELOG.md | |
build: | |
runs-on: ubuntu-latest | |
needs: [changelog] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Download PAX | |
uses: dsaltares/fetch-gh-release-asset@master | |
with: | |
repo: froehlichA/pax | |
file: "pax" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Download changelog | |
uses: actions/download-artifact@v2 | |
with: | |
name: changelog | |
- name: Move changelog | |
run: mv ./CHANGELOG.md ./modpack/CHANGELOG.md | |
- name: Export modpack | |
run: | | |
sudo chmod +x ./pax | |
./pax export | |
- name: Rename zip | |
run: | | |
mv .out/${{ env.PROJECT_NAME }}.zip .out/${{ env.PROJECT_NAME }}-${{ github.event.inputs.modpack-version }}.zip | |
- name: Upload zip | |
uses: actions/upload-artifact@v2 | |
with: | |
name: modpack | |
path: .out/${{ env.PROJECT_NAME }}-${{ github.event.inputs.modpack-version }}.zip | |
# release-github: | |
# runs-on: ubuntu-latest | |
# needs: [build, changelog] | |
# steps: | |
# - name: Download modpack | |
# uses: actions/download-artifact@v2 | |
# with: | |
# name: modpack | |
# - name: Download changelog | |
# uses: actions/download-artifact@v2 | |
# with: | |
# name: changelog | |
# - name: Create tag | |
# uses: actions/github-script@v5 | |
# with: | |
# script: | | |
# github.rest.git.createRef({ | |
# owner: context.repo.owner, | |
# repo: context.repo.repo, | |
# ref: 'refs/tags/github.event.inputs.modpack-version', | |
# sha: context.sha | |
# }) | |
# - name: Create release | |
# uses: softprops/action-gh-release@v1 | |
# with: | |
# body_path: CHANGELOG.md | |
# files: ${{ env.PROJECT_NAME }}-${{ github.event.inputs.modpack-version }}.zip | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
release-curseforge: | |
runs-on: ubuntu-latest | |
needs: [build, changelog] | |
steps: | |
- name: Download modpack | |
uses: actions/download-artifact@v2 | |
with: | |
name: modpack | |
- name: Get release type | |
id: release-type | |
run: | | |
rel_type="release" | |
case "${{ github.event.inputs.modpack-version }}" in | |
*alpha*) rel_type="alpha" ;; | |
*beta*) rel_type="beta" ;; | |
*) rel_type="release" ;; | |
esac | |
echo "::set-output name=type::$rel_type" | |
- name: Create release | |
uses: itsmeow/curseforge-upload@v3 | |
with: | |
token: ${{ env.CURSEFORGE_TOKEN }} | |
project_id: ${{ env.PROJECT_ID }} | |
game_endpoint: minecraft | |
file_path: ${{ env.PROJECT_NAME }}-${{ github.event.inputs.modpack-version }}.zip | |
changelog: "${{ needs.changelog.outputs.changelog }}" | |
changelog_type: markdown | |
game_versions: "Minecraft ${{ env.MINECRAFT_VERSION }}" | |
release_type: ${{ steps.release-type.outputs.type }} |